Something went wrong. Try again.
🐿️ Type safe SQL in Gleam
Something went wrong. Try again.
552 B · 30 lines
at bits-support
12345678910111213141516171819202122232425262728293031---version: 1.4.0title: string encodingfile: ./test/squirrel_test.gleamtest_name: string_encoding_test---import gleam/dynamic/decodeimport pogpub type QueryRow { QueryRow(res: Bool)}pub fn query( db: pog.Connection, arg_1: String,) -> Result(pog.Returned(QueryRow), pog.QueryError) { let decoder = { use res <- decode.field(0, decode.bool) decode.success(QueryRow(res:)) } "select true as res where $1 = 'wibble'" |> pog.query |> pog.parameter(pog.text(arg_1)) |> pog.returning(decoder) |> pog.execute(db)}