Skip to content

Commit

Permalink
consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
inoas committed Jun 27, 2024
1 parent ccd4c8b commit cf4a08f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 15 deletions.
15 changes: 9 additions & 6 deletions birdie_snapshots/insert_values_prepared_statement_test.accepted
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,35 @@ test_name: insert_values_prepared_statement_test
#(
PreparedStatement(
"$",
"INSERT INTO cats (name, age) VALUES ($1, $2) RETURNING name",
"INSERT INTO cats (name, rating, age) VALUES ($1, $2, $3) RETURNING name",
[
StringParam("Whiskers"),
FloatParam(5.0),
IntParam(5),
],
2,
3,
Postgres,
),
PreparedStatement(
"?",
"INSERT INTO cats (name, age) VALUES (?1, ?2) RETURNING name",
"INSERT INTO cats (name, rating, age) VALUES (?1, ?2, ?3) RETURNING name",
[
StringParam("Whiskers"),
FloatParam(5.0),
IntParam(5),
],
2,
3,
Sqlite,
),
PreparedStatement(
"?",
"INSERT INTO cats (name, age) VALUES (?, ?)",
"INSERT INTO cats (name, rating, age) VALUES (?, ?, ?)",
[
StringParam("Whiskers"),
FloatParam(5.0),
IntParam(5),
],
2,
3,
Maria,
),
)
30 changes: 27 additions & 3 deletions birdie_snapshots/insert_values_test.accepted
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,22 @@ test_name: insert_values_test
#(
InsertQuery(Insert(
InsertIntoTable("cats"),
InsertColumns(["name", "age"]),
InsertColumns([
"name",
"rating",
"age",
]),
NoInsertModifier,
InsertSourceRows([
InsertRow([
InsertParam(
"name",
StringParam("Whiskers"),
),
InsertParam(
"rating",
FloatParam(5.0),
),
InsertParam("age", IntParam(5)),
]),
]),
Expand All @@ -25,14 +33,22 @@ test_name: insert_values_test
)),
InsertQuery(Insert(
InsertIntoTable("cats"),
InsertColumns(["name", "age"]),
InsertColumns([
"name",
"rating",
"age",
]),
NoInsertModifier,
InsertSourceRows([
InsertRow([
InsertParam(
"name",
StringParam("Whiskers"),
),
InsertParam(
"rating",
FloatParam(5.0),
),
InsertParam("age", IntParam(5)),
]),
]),
Expand All @@ -43,14 +59,22 @@ test_name: insert_values_test
)),
InsertQuery(Insert(
InsertIntoTable("cats"),
InsertColumns(["name", "age"]),
InsertColumns([
"name",
"rating",
"age",
]),
NoInsertModifier,
InsertSourceRows([
InsertRow([
InsertParam(
"name",
StringParam("Whiskers"),
),
InsertParam(
"rating",
FloatParam(5.0),
),
InsertParam("age", IntParam(5)),
]),
]),
Expand Down
5 changes: 2 additions & 3 deletions test/cake_test/insert_records_test.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ type Cat {
Cat(name: String, age: Int, is_wild: Bool, rating: Float)
}

fn cat_caster(cat cat: Cat) {
fn cat_caster(cat: Cat) {
[
i.param(column: "name", param: cat.name |> i.string),
i.param(column: "rating", param: cat.rating |> i.float),
i.param(column: "age", param: cat.age |> i.int),
// i.param(column: "owner_id", param: i.null()),
// i.param(column: "iw_wild", param: cat.is_wild |> i.bool),
// i.param(column: "owner_id", param: i.null()), i.param(column: "is_wild", param: cat.is_wild |> i.bool),
]
|> i.row
}
Expand Down
8 changes: 5 additions & 3 deletions test/cake_test/insert_values_test.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@ fn insert_values() {
let cat =
[
i.param(column: "name", param: "Whiskers" |> i.string),
i.param(column: "rating", param: 5.0 |> i.float),
i.param(column: "age", param: 5 |> i.int),
// i.param(column: "is_wild", param: False |> i.bool),
// i.param(column: "owner_id", param: i.null()),
// i.param(column: "is_wild", param: False |> i.bool),
]
|> i.row

i.from_values(
table_name: "cats",
columns: [
"name", "age",
// , "is_wild"
"name", "rating", "age",
// "owner_id", "is_wild"
],
records: [cat],
)
Expand Down

0 comments on commit cf4a08f

Please sign in to comment.