Something went wrong. Try again.
🐿️ Type safe SQL in Gleam
Something went wrong. Try again.
590 B · 30 lines
at bits-support
12345678910111213141516171819202122232425262728293031---version: 1.4.0title: array encodingfile: ./test/squirrel_test.gleamtest_name: array_encoding_test---import gleam/dynamic/decodeimport pogpub 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)}