🐿️ Type safe SQL in Gleam
0

Configure Feed

Select the types of activity you want to include in your feed.

squirrel / test / birdie_snapshots / array_decoding.accepted
520 B 28 lines
1--- 2version: 2.0.0 3title: array decoding 4file: ./test/squirrel_test.gleam 5test_name: array_decoding_test 6--- 7 8import gleam/dynamic/decode 9import pog 10 11pub type QueryRow { 12 QueryRow(res: List(Int)) 13} 14 15pub fn query( 16 connection: pog.Connection, 17) -> Result(pog.Returned(QueryRow), pog.QueryError) { 18 let decoder = { 19 use res <- decode.field(0, decode.list(decode.int)) 20 decode.success(QueryRow(res:)) 21 } 22 23 "select array[1, 2, 3] as res" 24 |> pog.query 25 |> pog.returning(decoder) 26 |> pog.execute(connection) 27} 28