--- version: 1.2.5 title: array decoding file: ./test/squirrel_test.gleam test_name: array_decoding_test --- import gleam/dynamic/decode import 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) }