--- version: 1.4.0 title: array encoding file: ./test/squirrel_test.gleam test_name: array_encoding_test --- import gleam/dynamic/decode import pog pub type QueryRow { QueryRow(res: Bool) } pub fn query( db: pog.Connection, arg_1: List(Int), ) -> Result(pog.Returned(QueryRow), pog.QueryError) { let decoder = { use res <- decode.field(0, decode.bool) decode.success(QueryRow(res:)) } "select true as res where $1 = array[1, 2, 3]" |> pog.query |> pog.parameter(pog.array(fn(value) { pog.int(value) }, arg_1)) |> pog.returning(decoder) |> pog.execute(db) }