Something went wrong. Try again.
🐿️ Type safe SQL in Gleam
Something went wrong. Try again.
520 B · 28 lines
at main
1234567891011121314151617181920212223242526272829---version: 2.0.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( connection: 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(connection)}