AlterToOverNull.yql 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. (
  2. (library "alterto.yql")
  3. (import alterto_module '"alterto.yql")
  4. (let config (DataSource 'config))
  5. (let world (Configure! world config 'PureDataSource 'yt))
  6. # Null -> Uint16?
  7. (let targetType (OptionalType (DataType 'Uint16)))
  8. (let world (Apply (bind alterto_module 'doAlterTo) world (Null) targetType (Just (Uint16 '12345))))
  9. # Just(Null) -> Null
  10. (let alterToResult (AlterTo (Just (Null)) (NullType) (lambda '(x) (String 'OK)) (String 'FAIL)))
  11. (let res_sink (DataSink 'result))
  12. (let world (Write! world res_sink (Key) alterToResult '('('type))))
  13. # Nothing(Null?) -> Null
  14. (let alterToResult (AlterTo (Nothing (OptionalType (NullType))) (NullType) (lambda '(x) (String 'OK)) (String 'FAIL)))
  15. (let res_sink (DataSink 'result))
  16. (let world (Write! world res_sink (Key) alterToResult '('('type))))
  17. # Nothing(Uint16?) -> Null
  18. (let alterToResult (AlterTo (Nothing (OptionalType (DataType 'Uint16))) (NullType) (lambda '(x) (String 'OK)) (String 'FAIL)))
  19. (let res_sink (DataSink 'result))
  20. (let world (Write! world res_sink (Key) alterToResult '('('type))))
  21. # Null -> Null?
  22. (let alterToResult (AlterTo (Null) (OptionalType (NullType)) (lambda '(x) (String 'OK)) (String 'FAIL)))
  23. (let res_sink (DataSink 'result))
  24. (let world (Write! world res_sink (Key) alterToResult '('('type))))
  25. (let world (Commit! world res_sink))
  26. (return world)
  27. )