snapshot of https://github.com/sqlc-dev/sqlc.git (main, 2026-09-16; blobs > 131072B omitted)
Some checks failed
kotlin / test (push) Has been skipped
python / test (push) Has been skipped
typescript / test (push) Has been skipped
go / build darwin/amd64 (push) Has been cancelled
go / build linux/amd64 (push) Has been cancelled
go / build windows/amd64 (push) Has been cancelled
go / build darwin/arm64 (push) Has been cancelled
go / build linux/arm64 (push) Has been cancelled
go / build windows/arm64 (push) Has been cancelled
go / test (push) Has been cancelled
go / vuln_check (push) Has been cancelled
Some checks failed
kotlin / test (push) Has been skipped
python / test (push) Has been skipped
typescript / test (push) Has been skipped
go / build darwin/amd64 (push) Has been cancelled
go / build linux/amd64 (push) Has been cancelled
go / build windows/amd64 (push) Has been cancelled
go / build darwin/arm64 (push) Has been cancelled
go / build linux/arm64 (push) Has been cancelled
go / build windows/arm64 (push) Has been cancelled
go / test (push) Has been cancelled
go / vuln_check (push) Has been cancelled
This commit is contained in:
5
internal/endtoend/testdata/analyze_select/duckdb/exec.json
vendored
Normal file
5
internal/endtoend/testdata/analyze_select/duckdb/exec.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"command": "analyze",
|
||||
"args": ["--dialect", "duckdb", "--schema", "schema.sql", "query.sql"],
|
||||
"contexts": ["base"]
|
||||
}
|
||||
16
internal/endtoend/testdata/analyze_select/duckdb/query.sql
vendored
Normal file
16
internal/endtoend/testdata/analyze_select/duckdb/query.sql
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
-- name: ListUsers :many
|
||||
SELECT * FROM users;
|
||||
|
||||
-- name: CountUsers :one
|
||||
SELECT count(*) AS total FROM users;
|
||||
|
||||
-- name: ListUserPosts :many
|
||||
SELECT u.name, p.* FROM users u JOIN posts p ON p.user_id = u.id WHERE u.name = $1;
|
||||
|
||||
-- name: TopUsers :many
|
||||
WITH counts AS (
|
||||
SELECT user_id, count(*) AS n FROM posts GROUP BY user_id
|
||||
)
|
||||
SELECT u.name, c.n FROM users u JOIN counts c ON c.user_id = u.id
|
||||
ORDER BY c.n DESC
|
||||
LIMIT 5;
|
||||
12
internal/endtoend/testdata/analyze_select/duckdb/schema.sql
vendored
Normal file
12
internal/endtoend/testdata/analyze_select/duckdb/schema.sql
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
CREATE TABLE users (
|
||||
id BIGINT NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
age INTEGER
|
||||
);
|
||||
|
||||
CREATE TABLE posts (
|
||||
id BIGINT NOT NULL,
|
||||
user_id BIGINT NOT NULL,
|
||||
title TEXT NOT NULL,
|
||||
body TEXT
|
||||
);
|
||||
118
internal/endtoend/testdata/analyze_select/duckdb/stdout.json
vendored
Normal file
118
internal/endtoend/testdata/analyze_select/duckdb/stdout.json
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
[
|
||||
{
|
||||
"name": "ListUsers",
|
||||
"cmd": ":many",
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "users"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "varchar"
|
||||
},
|
||||
"table": "users"
|
||||
},
|
||||
{
|
||||
"name": "age",
|
||||
"type": {
|
||||
"name": "integer",
|
||||
"nullable": true
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
],
|
||||
"params": []
|
||||
},
|
||||
{
|
||||
"name": "CountUsers",
|
||||
"cmd": ":one",
|
||||
"columns": [
|
||||
{
|
||||
"name": "total",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
}
|
||||
}
|
||||
],
|
||||
"params": []
|
||||
},
|
||||
{
|
||||
"name": "ListUserPosts",
|
||||
"cmd": ":many",
|
||||
"columns": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "varchar"
|
||||
},
|
||||
"table": "users"
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "posts"
|
||||
},
|
||||
{
|
||||
"name": "user_id",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "posts"
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": {
|
||||
"name": "varchar"
|
||||
},
|
||||
"table": "posts"
|
||||
},
|
||||
{
|
||||
"name": "body",
|
||||
"type": {
|
||||
"name": "varchar",
|
||||
"nullable": true
|
||||
},
|
||||
"table": "posts"
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"column": {
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "varchar"
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "TopUsers",
|
||||
"cmd": ":many",
|
||||
"columns": [
|
||||
{
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "varchar"
|
||||
},
|
||||
"table": "users"
|
||||
},
|
||||
{
|
||||
"name": "n",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
}
|
||||
}
|
||||
],
|
||||
"params": []
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user