Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

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,4 @@
CREATE TABLE foo (a int, b int);

-- name: SubqueryCalcColumn :many
SELECT sum FROM (SELECT a + b AS sum FROM foo) AS f;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "1",
"packages": [
{
"path": "go",
"engine": "sqlite",
"name": "querytest",
"schema": "query.sql",
"queries": "query.sql"
}
]
}
32 changes: 32 additions & 0 deletions internal/endtoend/testdata/table_function/postgresql/pgx/go/db.go

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.

20 changes: 20 additions & 0 deletions internal/endtoend/testdata/table_function/postgresql/pgx/query.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
CREATE TABLE transactions (
id BIGSERIAL PRIMARY KEY,
uri text NOT NULL,
program_id text NOT NULL,
data text NOT NULL
);

/* name: GetTransaction :many */
SELECT
json_extract(transactions.data, '$.transaction.signatures[0]'),
json_group_array(instructions.value)
FROM
transactions,
json_each(json_extract(transactions.data, '$.transaction.message.instructions')) AS instructions
WHERE
transactions.program_id = $1
AND json_extract(transactions.data, '$.transaction.signatures[0]') > $2
AND json_extract(json_extract(transactions.data, '$.transaction.message.accountKeys'), '$[' || json_extract(instructions.value, '$.programIdIndex') || ']') = transactions.program_id
GROUP BY transactions.id
LIMIT $3;
13 changes: 13 additions & 0 deletions internal/endtoend/testdata/table_function/postgresql/pgx/sqlc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": "1",
"packages": [
{
"path": "go",
"engine": "postgresql",
"sql_package": "pgx/v4",
"name": "querytest",
"schema": "query.sql",
"queries": "query.sql"
}
]
}

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,20 @@
CREATE TABLE transactions (
id BIGSERIAL PRIMARY KEY,
uri text NOT NULL,
program_id text NOT NULL,
data text NOT NULL
);

/* name: GetTransaction :many */
SELECT
json_extract(transactions.data, '$.transaction.signatures[0]'),
json_group_array(instructions.value)
FROM
transactions,
json_each(json_extract(transactions.data, '$.transaction.message.instructions')) AS instructions
WHERE
transactions.program_id = $1
AND json_extract(transactions.data, '$.transaction.signatures[0]') > $2
AND json_extract(json_extract(transactions.data, '$.transaction.message.accountKeys'), '$[' || json_extract(instructions.value, '$.programIdIndex') || ']') = transactions.program_id
GROUP BY transactions.id
LIMIT $3;
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "1",
"packages": [
{
"path": "go",
"engine": "postgresql",
"name": "querytest",
"schema": "query.sql",
"queries": "query.sql"
}
]
}
Loading