AlterToOverOptional.yqls 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. (
  2. (library "alterto.yql")
  3. (import alterto_module '"alterto.yql")
  4. (let config (DataSource 'config))
  5. (let res_sink (DataSink 'result))
  6. # Int32? -> Uint16
  7. (let world (Apply (bind alterto_module 'doAlterTo) world (Just (Int32 '1)) (DataType 'Uint16) (Uint16 '12345)))
  8. (let world (Apply (bind alterto_module 'doAlterTo) world (Just (Int32 '1000000)) (DataType 'Uint16) (Uint16 '12345)))
  9. (let world (Apply (bind alterto_module 'doAlterTo) world (Nothing (OptionalType (DataType 'Int32))) (DataType 'Uint16) (Uint16 '12345)))
  10. # Int32? -> Uint16?
  11. (let targetType (OptionalType (DataType 'Uint16)))
  12. (let world (Apply (bind alterto_module 'doAlterTo) world (Just (Int32 '1)) targetType (Just (Uint16 '12345))))
  13. (let world (Apply (bind alterto_module 'doAlterTo) world (Just (Int32 '1000000)) targetType (Just (Uint16 '12345))))
  14. (let world (Apply (bind alterto_module 'doAlterTo) world (Nothing (OptionalType (DataType 'Int32))) targetType (Just (Uint16 '12345))))
  15. # Int32? -> Uint16???
  16. (let targetType (OptionalType (OptionalType (OptionalType (DataType 'Uint16)))))
  17. (let world (Apply (bind alterto_module 'doAlterTo) world (Just (Int32 '1)) targetType (Just (Just (Just (Uint16 '12345))))))
  18. (let world (Apply (bind alterto_module 'doAlterTo) world (Just (Int32 '1000000)) targetType (Just (Just (Just (Uint16 '12345))))))
  19. (let world (Apply (bind alterto_module 'doAlterTo) world (Nothing (OptionalType (DataType 'Int32))) targetType (Just (Just (Just (Uint16 '12345))))))
  20. # Int32??? -> Uint16?
  21. (let targetType (OptionalType (DataType 'Uint16)))
  22. (let world (Apply (bind alterto_module 'doAlterTo) world (Just (Just (Just (Int32 '1)))) targetType (Just (Uint16 '12345))))
  23. (let world (Apply (bind alterto_module 'doAlterTo) world (Just (Just (Just (Int32 '1000000)))) targetType (Just (Uint16 '12345))))
  24. (let world (Apply (bind alterto_module 'doAlterTo) world (Nothing (OptionalType (OptionalType (OptionalType (DataType 'Int32))))) targetType (Just (Uint16 '12345))))
  25. (let world (Apply (bind alterto_module 'doAlterTo) world (Just (Nothing (OptionalType (OptionalType (DataType 'Int32))))) targetType (Just (Uint16 '12345))))
  26. (let world (Apply (bind alterto_module 'doAlterTo) world (Just (Just (Nothing (OptionalType (DataType 'Int32))))) targetType (Just (Uint16 '12345))))
  27. # Int32? -> Null
  28. (let targetType (NullType))
  29. (let alterToResult (AlterTo (Just (Int32 '1)) targetType (lambda '(x) (String '"converted")) (String '"not converted")))
  30. (let world (Write! world res_sink (Key) alterToResult '('('type))))
  31. (let alterToResult (AlterTo (Nothing (OptionalType (DataType 'Int32))) targetType (lambda '(x) (String '"converted")) (String '"not converted")))
  32. (let world (Write! world res_sink (Key) alterToResult '('('type))))
  33. # Int64? -> Null?
  34. (let targetType (NullType))
  35. (let alterToResult (AlterTo (Just (Int64 '1)) targetType (lambda '(x) (String '"converted")) (String '"not converted")))
  36. (let world (Write! world res_sink (Key) alterToResult '('('type))))
  37. (let alterToResult (AlterTo (Nothing (OptionalType (DataType 'Int64))) targetType (lambda '(x) (String '"converted")) (String '"not converted")))
  38. (let world (Write! world res_sink (Key) alterToResult '('('type))))
  39. (let world (Commit! world res_sink))
  40. (return world)
  41. )