Something went wrong. Try again.
🐿️ Type safe SQL in Gleam
Something went wrong. Try again.
500 B · 28 lines
at bits-support
1234567891011121314151617181920212223242526272829---version: 1.4.0title: numeric decodingfile: ./test/squirrel_test.gleamtest_name: numeric_decoding_test---import gleam/dynamic/decodeimport pogpub type QueryRow { QueryRow(res: Float)}pub fn query( db: pog.Connection,) -> Result(pog.Returned(QueryRow), pog.QueryError) { let decoder = { use res <- decode.field(0, pog.numeric_decoder()) decode.success(QueryRow(res:)) } "select 1.1::numeric as res" |> pog.query |> pog.returning(decoder) |> pog.execute(db)}