AlterToOverNull.yqls 1.2 KB

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