AlterToOverTuple.yqls 580 B

123456789101112131415161718192021
  1. (
  2. (library "alterto.yql")
  3. (import alterto_module '"alterto.yql")
  4. (let config (DataSource 'config))
  5. (let targetType (TupleType (DataType 'Uint8) (DataType 'Utf8)))
  6. (let failValue '((Uint8 '0) (Utf8 '"not converted")))
  7. # (Int32, String) -> (Uint8, Utf8)
  8. (let value '((Int32 '1) (String 'one)))
  9. (let world (Apply (bind alterto_module 'doAlterTo) world value targetType failValue))
  10. # (Int32, String) -> (Uint8, Utf8) (fail)
  11. (let value '((Int32 '1) (String '"garbage\xff")))
  12. (let world (Apply (bind alterto_module 'doAlterTo) world value targetType failValue))
  13. (return world)
  14. )