|
|
|
@ -81,7 +81,7 @@ describe("SQL query builder", () => { |
|
|
|
})) |
|
|
|
expect(query).toEqual({ |
|
|
|
bindings: ["John%", limit], |
|
|
|
sql: `select * from "${TABLE_NAME}" where "name" like $1 limit $2` |
|
|
|
sql: `select * from "${TABLE_NAME}" where "${TABLE_NAME}"."name" like $1 limit $2` |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
@ -98,7 +98,7 @@ describe("SQL query builder", () => { |
|
|
|
})) |
|
|
|
expect(query).toEqual({ |
|
|
|
bindings: [2, 10, limit], |
|
|
|
sql: `select * from "${TABLE_NAME}" where "age" between $1 and $2 limit $3` |
|
|
|
sql: `select * from "${TABLE_NAME}" where "${TABLE_NAME}"."age" between $1 and $2 limit $3` |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
@ -114,7 +114,7 @@ describe("SQL query builder", () => { |
|
|
|
})) |
|
|
|
expect(query).toEqual({ |
|
|
|
bindings: [10, "John", limit], |
|
|
|
sql: `select * from "${TABLE_NAME}" where ("age" = $1) or ("name" = $2) limit $3` |
|
|
|
sql: `select * from "${TABLE_NAME}" where ("${TABLE_NAME}"."age" = $1) or ("${TABLE_NAME}"."name" = $2) limit $3` |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
@ -139,7 +139,7 @@ describe("SQL query builder", () => { |
|
|
|
})) |
|
|
|
expect(query).toEqual({ |
|
|
|
bindings: ["John", 1001], |
|
|
|
sql: `update "${TABLE_NAME}" set "name" = $1 where "id" = $2 returning *` |
|
|
|
sql: `update "${TABLE_NAME}" set "name" = $1 where "${TABLE_NAME}"."id" = $2 returning *` |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
@ -151,7 +151,7 @@ describe("SQL query builder", () => { |
|
|
|
})) |
|
|
|
expect(query).toEqual({ |
|
|
|
bindings: [1001], |
|
|
|
sql: `delete from "${TABLE_NAME}" where "id" = $1 returning *` |
|
|
|
sql: `delete from "${TABLE_NAME}" where "${TABLE_NAME}"."id" = $1 returning *` |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|