-
Notifications
You must be signed in to change notification settings - Fork 731
Commit
* fix(compiler): Pull in array information from analyzer Fixes #1532 * test(analyzer): Add testcase for #1574 * test: Added test for #1634 * test: Add test case for #1646 * test: Add test for #1714 * Fixes #1912 * test: Add case for #1916 * test: Add two test cases #1917 #1545 * test: Add case for #1979 * test: Add case for #1990
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
https://github.com/sqlc-dev/sqlc/issues/1219 | ||
https://github.com/sqlc-dev/sqlc/issues/1219 | ||
https://github.com/sqlc-dev/sqlc/issues/1912 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
https://github.com/sqlc-dev/sqlc/issues/1916 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"contexts": ["managed-db"] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-- name: UpdateUserAddressWithAddress :one | ||
WITH t1 AS ( | ||
UPDATE "address" as a | ||
SET | ||
address_line = COALESCE(sqlc.narg(address_line),address_line), | ||
region = COALESCE(sqlc.narg(region),region), | ||
city= COALESCE(sqlc.narg(city),city) | ||
WHERE id = COALESCE(sqlc.arg(id),id) | ||
RETURNING a.id, a.address_line, a.region, a.city | ||
), | ||
|
||
t2 AS ( | ||
UPDATE "user_address" | ||
SET | ||
default_address = COALESCE(sqlc.narg(default_address),default_address) | ||
WHERE | ||
user_id = COALESCE(sqlc.arg(user_id),user_id) | ||
AND address_id = COALESCE(sqlc.arg(address_id),address_id) | ||
RETURNING user_id, address_id, default_address | ||
) | ||
|
||
SELECT | ||
user_id, | ||
address_id, | ||
default_address, | ||
address_line, | ||
region, | ||
city From t1,t2; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
CREATE TABLE "user" ( | ||
"id" bigserial PRIMARY KEY NOT NULL, | ||
"username" varchar NOT NULL, | ||
"email" varchar UNIQUE NOT NULL, | ||
"password" varchar NOT NULL, | ||
"telephone" int NOT NULL DEFAULT 0, | ||
"default_payment" bigint, | ||
"created_at" timestamptz NOT NULL DEFAULT (now()), | ||
"updated_at" timestamptz NOT NULL DEFAULT '0001-01-01 00:00:00Z' | ||
); | ||
|
||
CREATE TABLE "address" ( | ||
"id" bigserial PRIMARY KEY NOT NULL, | ||
"address_line" varchar NOT NULL, | ||
"region" varchar NOT NULL, | ||
"city" varchar NOT NULL, | ||
"created_at" timestamptz NOT NULL DEFAULT (now()), | ||
"updated_at" timestamptz NOT NULL DEFAULT '0001-01-01 00:00:00Z' | ||
); | ||
|
||
CREATE TABLE "user_address" ( | ||
"user_id" bigint NOT NULL, | ||
"address_id" bigint UNIQUE NOT NULL, | ||
"default_address" bigint, | ||
"created_at" timestamptz NOT NULL DEFAULT (now()), | ||
"updated_at" timestamptz NOT NULL DEFAULT '0001-01-01 00:00:00Z' | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: "2" | ||
sql: | ||
- engine: "postgresql" | ||
schema: "schema.sql" | ||
queries: "query.sql" | ||
gen: | ||
go: | ||
package: "querytest" | ||
out: "go" | ||
sql_package: "pgx/v5" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
https://github.com/sqlc-dev/sqlc/issues/1917 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"contexts": ["managed-db"] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- name: SelectOne :one | ||
SELECT 1; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
CREATE TABLE test_table ( | ||
id STRING | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: "2" | ||
sql: | ||
- engine: "postgresql" | ||
schema: "schema.sql" | ||
queries: "query.sql" | ||
gen: | ||
go: | ||
package: "querytest" | ||
out: "go" | ||
sql_package: "pgx/v5" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# package querytest | ||
query.sql:1:1: rpc error: code = FailedPrecondition desc = type "string" does not exist (42704) | ||
CREATE TABLE test_table ( | ||
id STRING | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
https://github.com/sqlc-dev/sqlc/issues/1545 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"contexts": ["managed-db"] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- name: GetTotalEarned :one | ||
SELECT COALESCE(SUM(earned), 0) as total_earned | ||
FROM grouped_kpis | ||
WHERE day = @day; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CREATE TABLE kpis ( | ||
ts TIMESTAMPTZ, | ||
event_id TEXT NOT NULL | ||
); | ||
|
||
CREATE MATERIALIZED VIEW IF NOT EXISTS grouped_kpis AS | ||
SELECT date_trunc('1 day', ts) as day, COUNT(*) | ||
FROM kpis | ||
GROUP BY 1; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: "2" | ||
sql: | ||
- engine: "postgresql" | ||
schema: "schema.sql" | ||
queries: "query.sql" | ||
gen: | ||
go: | ||
package: "querytest" | ||
out: "go" | ||
sql_package: "pgx/v5" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# package querytest | ||
query.sql:2:21: column "earned" does not exist |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
https://github.com/sqlc-dev/sqlc/issues/1714 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"contexts": ["managed-db"] | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.