--- version: 1.2.5 title: string decoding file: ./test/squirrel_test.gleam test_name: string_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: String) } /// 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.string) decode.success(QueryRow(res:)) } "select 'wibble' as res" |> pog.query |> pog.returning(decoder) |> pog.execute(db) }