Something went wrong. Try again.
🐿️ Type safe SQL in Gleam
Something went wrong. Try again.
504 B · 28 lines
at bits-support
1234567891011121314151617181920212223242526272829---version: 1.4.0title: array decodingfile: ./test/squirrel_test.gleamtest_name: array_decoding_test---import gleam/dynamic/decodeimport pogpub type QueryRow { QueryRow(res: List(Int))}pub fn query( db: pog.Connection,) -> Result(pog.Returned(QueryRow), pog.QueryError) { let decoder = { use res <- decode.field(0, decode.list(decode.int)) decode.success(QueryRow(res:)) } "select array[1, 2, 3] as res" |> pog.query |> pog.returning(decoder) |> pog.execute(db)}