wip: currently rewriting the project as a full stack application
tangled.org/kacaii.dev/sigo
gleam
1//// This module contains the code to run the sql queries defined in
2//// `./dev/app_dev/sql`.
3//// > 🐿️ This module was generated automatically using v4.6.0 of
4//// > the [squirrel package](https://github.com/giacomocavalieri/squirrel).
5////
6
7import gleam/dynamic/decode
8import pog
9
10/// Runs the `soft_truncate_user_account` query
11/// defined in `./dev/app_dev/sql/soft_truncate_user_account.sql`.
12///
13/// > 🐿️ This function was generated automatically using v4.6.0 of
14/// > the [squirrel package](https://github.com/giacomocavalieri/squirrel).
15///
16pub fn soft_truncate_user_account(
17 db: pog.Connection,
18) -> Result(pog.Returned(Nil), pog.QueryError) {
19 let decoder = decode.map(decode.dynamic, fn(_) { Nil })
20
21 "delete from public.user_account
22where registration != '000';
23"
24 |> pog.query
25 |> pog.returning(decoder)
26 |> pog.execute(db)
27}
28
29/// Runs the `truncate_brigade` query
30/// defined in `./dev/app_dev/sql/truncate_brigade.sql`.
31///
32/// > 🐿️ This function was generated automatically using v4.6.0 of
33/// > the [squirrel package](https://github.com/giacomocavalieri/squirrel).
34///
35pub fn truncate_brigade(
36 db: pog.Connection,
37) -> Result(pog.Returned(Nil), pog.QueryError) {
38 let decoder = decode.map(decode.dynamic, fn(_) { Nil })
39
40 "truncate table public.brigade cascade;
41"
42 |> pog.query
43 |> pog.returning(decoder)
44 |> pog.execute(db)
45}
46
47/// Runs the `truncate_occurrence` query
48/// defined in `./dev/app_dev/sql/truncate_occurrence.sql`.
49///
50/// > 🐿️ This function was generated automatically using v4.6.0 of
51/// > the [squirrel package](https://github.com/giacomocavalieri/squirrel).
52///
53pub fn truncate_occurrence(
54 db: pog.Connection,
55) -> Result(pog.Returned(Nil), pog.QueryError) {
56 let decoder = decode.map(decode.dynamic, fn(_) { Nil })
57
58 "truncate table public.occurrence cascade;
59"
60 |> pog.query
61 |> pog.returning(decoder)
62 |> pog.execute(db)
63}