Skip to content

Commit

Permalink
try to add with_connection for pgo
Browse files Browse the repository at this point in the history
  • Loading branch information
inoas committed Apr 23, 2024
1 parent 75ffdd5 commit 65b6739
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/cake.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn run_on_postgres(query, query_decoder) {
use conn <- postgres_adapter.with_connection()

let _ =
create_dummy_cats_table()
create_dummy_fresh_cats_table()
|> postgres_adapter.execute(conn)
let _ =
insert_dummy_cats_data()
Expand All @@ -81,7 +81,7 @@ fn run_on_sqlite(query, query_decoder) {
use conn <- sqlite_adapter.with_memory_connection()

let _ =
create_dummy_cats_table()
create_dummy_fresh_cats_table()
|> sqlite_adapter.execute(conn)

let _ =
Expand All @@ -91,9 +91,9 @@ fn run_on_sqlite(query, query_decoder) {
sqlite_adapter.run_query(conn, query, query_decoder)
}

fn create_dummy_cats_table() {
io.println("create_dummy_cats_table")
"CREATE TABLE cats (name text, age int);"
fn create_dummy_fresh_cats_table() {
io.println("create_dummy_fresh_cats_table")
"DROP TABLE IF EXISTS cats; CREATE TABLE cats (name text, age int);"
}

fn insert_dummy_cats_data() {
Expand Down
1 change: 0 additions & 1 deletion src/cake/adapter/postgres_adapter.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pub fn with_connection(f: fn(Connection) -> a) -> a {
..pgo.default_config(),
host: "localhost",
database: "gleam_cake",
pool_size: 1,
),
)

Expand Down

0 comments on commit 65b6739

Please sign in to comment.