Something went wrong. Try again.
🐿️ Type safe SQL in Gleam
Something went wrong. Try again.
487 B · 28 lines
at bits-support
1234567891011121314151617181920212223242526272829---version: 1.4.0title: string decodingfile: ./test/squirrel_test.gleamtest_name: string_decoding_test---import gleam/dynamic/decodeimport pogpub type QueryRow { QueryRow(res: String)}pub fn query( db: pog.Connection,) -> Result(pog.Returned(QueryRow), pog.QueryError) { 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)}