🐿️ Type safe SQL in Gleam
1.3 kB
49 lines
1---
2version: 2.0.0
3title: query with multiline comment
4file: ./test/squirrel_test.gleam
5test_name: query_with_multiline_comment_test
6---
7//// This module contains the code to run the sql queries defined in
8//// `./test-directory`.
9//// > 🐿️ This module was generated automatically using v-test of
10//// > the [squirrel package](https://github.com/giacomocavalieri/squirrel).
11////
12
13import gleam/dynamic/decode
14import pog
15
16/// A row you get from running the `query` query
17/// defined in `query.sql`.
18///
19/// > 🐿️ This type definition was generated automatically using v-test of the
20/// > [squirrel package](https://github.com/giacomocavalieri/squirrel).
21///
22pub type QueryRow {
23 QueryRow(res: Bool)
24}
25
26/// This is a comment
27/// that goes over multiple lines!
28///
29/// > 🐿️ This function was generated automatically using v-test of
30/// > the [squirrel package](https://github.com/giacomocavalieri/squirrel).
31///
32pub fn query(
33 connection: pog.Connection,
34) -> Result(pog.Returned(QueryRow), pog.QueryError) {
35 let decoder = {
36 use res <- decode.field(0, decode.bool)
37 decode.success(QueryRow(res:))
38 }
39
40 "
41-- This is a comment
42-- that goes over multiple lines!
43select true as res
44"
45 |> pog.query
46 |> pog.returning(decoder)
47 |> pog.execute(connection)
48}
49