···11+//// This module contains the code to run the sql queries defined in
22+//// `./src/sweetnhouse_server/sql`.
33+//// > 🐿️ This module was generated automatically using v4.6.0 of
44+//// > the [squirrel package](https://github.com/giacomocavalieri/squirrel).
55+////
66+77+import gleam/dynamic/decode
88+import pog
99+1010+/// A row you get from running the `find_app_config` query
1111+/// defined in `./src/sweetnhouse_server/sql/find_app_config.sql`.
1212+///
1313+/// > 🐿️ This type definition was generated automatically using v4.6.0 of the
1414+/// > [squirrel package](https://github.com/giacomocavalieri/squirrel).
1515+///
1616+pub type FindAppConfigRow {
1717+ FindAppConfigRow(value: String)
1818+}
1919+2020+/// Find app_config by key
2121+///
2222+/// > 🐿️ This function was generated automatically using v4.6.0 of
2323+/// > the [squirrel package](https://github.com/giacomocavalieri/squirrel).
2424+///
2525+pub fn find_app_config(
2626+ db: pog.Connection,
2727+ arg_1: String,
2828+) -> Result(pog.Returned(FindAppConfigRow), pog.QueryError) {
2929+ let decoder = {
3030+ use value <- decode.field(0, decode.string)
3131+ decode.success(FindAppConfigRow(value:))
3232+ }
3333+3434+ "-- Find app_config by key
3535+SELECT
3636+ value
3737+FROM
3838+ app_config
3939+WHERE
4040+ key = $1
4141+"
4242+ |> pog.query
4343+ |> pog.parameter(pog.text(arg_1))
4444+ |> pog.returning(decoder)
4545+ |> pog.execute(db)
4646+}
4747+4848+/// Insert new app_config
4949+///
5050+/// > 🐿️ This function was generated automatically using v4.6.0 of
5151+/// > the [squirrel package](https://github.com/giacomocavalieri/squirrel).
5252+///
5353+pub fn insert_app_config(
5454+ db: pog.Connection,
5555+ arg_1: String,
5656+ arg_2: String,
5757+) -> Result(pog.Returned(Nil), pog.QueryError) {
5858+ let decoder = decode.map(decode.dynamic, fn(_) { Nil })
5959+6060+ "-- Insert new app_config
6161+INSERT INTO app_config (key, value) VALUES ($1, $2)
6262+"
6363+ |> pog.query
6464+ |> pog.parameter(pog.text(arg_1))
6565+ |> pog.parameter(pog.text(arg_2))
6666+ |> pog.returning(decoder)
6767+ |> pog.execute(db)
6868+}
6969+7070+/// Create app_config table if it doesnt exist yet
7171+///
7272+/// > 🐿️ This function was generated automatically using v4.6.0 of
7373+/// > the [squirrel package](https://github.com/giacomocavalieri/squirrel).
7474+///
7575+pub fn setup_database(
7676+ db: pog.Connection,
7777+) -> Result(pog.Returned(Nil), pog.QueryError) {
7878+ let decoder = decode.map(decode.dynamic, fn(_) { Nil })
7979+8080+ "-- Create app_config table if it doesnt exist yet
8181+CREATE TABLE IF NOT EXISTS app_config (
8282+ key TEXT PRIMARY KEY,
8383+ value TEXT NOT NULL
8484+)
8585+"
8686+ |> pog.query
8787+ |> pog.returning(decoder)
8888+ |> pog.execute(db)
8989+}
···11+-- Create app_config table if it doesnt exist yet
22+CREATE TABLE IF NOT EXISTS app_config (
33+ key TEXT PRIMARY KEY,
44+ value TEXT NOT NULL
55+)