Something went wrong. Try again.
🐿️ Type safe SQL in Gleam
Something went wrong. Try again.
882 B · 36 lines
at custom-types
12345678910111213141516171819202122232425262728293031323334353637---version: 1.2.5title: array decodingfile: ./test/squirrel_test.gleamtest_name: array_decoding_test---import gleam/dynamic/decodeimport pog/// A row you get from running the `query` query/// defined in `query.sql`.////// > 🐿️ This type definition was generated automatically using v-test of the/// > [squirrel package](https://github.com/giacomocavalieri/squirrel).///pub type QueryRow { QueryRow(res: List(Int))}/// Runs the `query` query/// defined in `query.sql`.////// > 🐿️ This function was generated automatically using v-test of/// > the [squirrel package](https://github.com/giacomocavalieri/squirrel).///pub fn query(db) { 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)}