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_params/clickhouse/exec.json
vendored
Normal file
5
internal/endtoend/testdata/analyze_params/clickhouse/exec.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"command": "analyze",
|
||||
"args": ["--dialect", "clickhouse", "--schema", "schema.sql", "query.sql"],
|
||||
"contexts": ["base"]
|
||||
}
|
||||
2
internal/endtoend/testdata/analyze_params/clickhouse/fixture.sql
vendored
Normal file
2
internal/endtoend/testdata/analyze_params/clickhouse/fixture.sql
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
INSERT INTO events (id, name, tag, amount, created) VALUES (1, 'signup', NULL, 9.5, '2024-01-01 00:00:00');
|
||||
INSERT INTO events (id, name, tag, amount, created) VALUES (2, 'login', 'web', 0.5, '2024-01-02 00:00:00');
|
||||
5
internal/endtoend/testdata/analyze_params/clickhouse/query.sql
vendored
Normal file
5
internal/endtoend/testdata/analyze_params/clickhouse/query.sql
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
-- name: GetEvent :one
|
||||
SELECT id, name FROM events WHERE id = ?;
|
||||
|
||||
-- name: FilterEvents :many
|
||||
SELECT id, name FROM events WHERE name = ? AND amount > ?;
|
||||
7
internal/endtoend/testdata/analyze_params/clickhouse/schema.sql
vendored
Normal file
7
internal/endtoend/testdata/analyze_params/clickhouse/schema.sql
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
CREATE TABLE events (
|
||||
id UInt64,
|
||||
name String,
|
||||
tag Nullable(String),
|
||||
amount Float64,
|
||||
created DateTime
|
||||
) ENGINE = MergeTree ORDER BY id;
|
||||
76
internal/endtoend/testdata/analyze_params/clickhouse/stdout.json
vendored
Normal file
76
internal/endtoend/testdata/analyze_params/clickhouse/stdout.json
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
[
|
||||
{
|
||||
"name": "GetEvent",
|
||||
"cmd": ":one",
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "uint64"
|
||||
},
|
||||
"table": "events"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "string"
|
||||
},
|
||||
"table": "events"
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"column": {
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "uint64"
|
||||
},
|
||||
"table": "events"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "FilterEvents",
|
||||
"cmd": ":many",
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "uint64"
|
||||
},
|
||||
"table": "events"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "string"
|
||||
},
|
||||
"table": "events"
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"column": {
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "string"
|
||||
},
|
||||
"table": "events"
|
||||
}
|
||||
},
|
||||
{
|
||||
"number": 2,
|
||||
"column": {
|
||||
"name": "amount",
|
||||
"type": {
|
||||
"name": "float64"
|
||||
},
|
||||
"table": "events"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
5
internal/endtoend/testdata/analyze_params/duckdb/exec.json
vendored
Normal file
5
internal/endtoend/testdata/analyze_params/duckdb/exec.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"command": "analyze",
|
||||
"args": ["--dialect", "duckdb", "--schema", "schema.sql", "query.sql"],
|
||||
"contexts": ["base"]
|
||||
}
|
||||
8
internal/endtoend/testdata/analyze_params/duckdb/query.sql
vendored
Normal file
8
internal/endtoend/testdata/analyze_params/duckdb/query.sql
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
-- name: GetAuthor :one
|
||||
SELECT id, name, bio FROM authors WHERE id = $1;
|
||||
|
||||
-- name: FilterAuthors :many
|
||||
SELECT id, name FROM authors WHERE name = $name AND royalties > $royalties;
|
||||
|
||||
-- name: SearchAuthors :many
|
||||
SELECT id FROM authors WHERE name LIKE ? AND bio IS NOT NULL;
|
||||
6
internal/endtoend/testdata/analyze_params/duckdb/schema.sql
vendored
Normal file
6
internal/endtoend/testdata/analyze_params/duckdb/schema.sql
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
CREATE TABLE authors (
|
||||
id BIGINT PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
bio TEXT,
|
||||
royalties DECIMAL(10,2) NOT NULL
|
||||
);
|
||||
117
internal/endtoend/testdata/analyze_params/duckdb/stdout.json
vendored
Normal file
117
internal/endtoend/testdata/analyze_params/duckdb/stdout.json
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
[
|
||||
{
|
||||
"name": "GetAuthor",
|
||||
"cmd": ":one",
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "authors"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "varchar"
|
||||
},
|
||||
"table": "authors"
|
||||
},
|
||||
{
|
||||
"name": "bio",
|
||||
"type": {
|
||||
"name": "varchar",
|
||||
"nullable": true
|
||||
},
|
||||
"table": "authors"
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"column": {
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "authors"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "FilterAuthors",
|
||||
"cmd": ":many",
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "authors"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "varchar"
|
||||
},
|
||||
"table": "authors"
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"column": {
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "varchar"
|
||||
},
|
||||
"table": "authors"
|
||||
}
|
||||
},
|
||||
{
|
||||
"number": 2,
|
||||
"column": {
|
||||
"name": "royalties",
|
||||
"type": {
|
||||
"name": "decimal",
|
||||
"args": [
|
||||
{
|
||||
"int": 10
|
||||
},
|
||||
{
|
||||
"int": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
"table": "authors"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "SearchAuthors",
|
||||
"cmd": ":many",
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "authors"
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"column": {
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "varchar"
|
||||
},
|
||||
"table": "authors"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
5
internal/endtoend/testdata/analyze_params/mssql/exec.json
vendored
Normal file
5
internal/endtoend/testdata/analyze_params/mssql/exec.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"command": "analyze",
|
||||
"args": ["--dialect", "mssql", "--schema", "schema.sql", "query.sql"],
|
||||
"contexts": ["base"]
|
||||
}
|
||||
5
internal/endtoend/testdata/analyze_params/mssql/query.sql
vendored
Normal file
5
internal/endtoend/testdata/analyze_params/mssql/query.sql
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
-- name: GetAuthor :one
|
||||
SELECT id, name, bio FROM authors WHERE id = @id;
|
||||
|
||||
-- name: FilterAuthors :many
|
||||
SELECT id, name FROM authors WHERE name = @name AND royalties > @royalties;
|
||||
7
internal/endtoend/testdata/analyze_params/mssql/schema.sql
vendored
Normal file
7
internal/endtoend/testdata/analyze_params/mssql/schema.sql
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
CREATE TABLE authors (
|
||||
id BIGINT IDENTITY(1,1) PRIMARY KEY,
|
||||
name NVARCHAR(100) NOT NULL,
|
||||
bio NVARCHAR(MAX),
|
||||
royalties DECIMAL(10,2) NOT NULL,
|
||||
created DATETIME2 NOT NULL
|
||||
);
|
||||
112
internal/endtoend/testdata/analyze_params/mssql/stdout.json
vendored
Normal file
112
internal/endtoend/testdata/analyze_params/mssql/stdout.json
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
[
|
||||
{
|
||||
"name": "GetAuthor",
|
||||
"cmd": ":one",
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "authors"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "nvarchar",
|
||||
"args": [
|
||||
{
|
||||
"int": 100
|
||||
}
|
||||
]
|
||||
},
|
||||
"table": "authors"
|
||||
},
|
||||
{
|
||||
"name": "bio",
|
||||
"type": {
|
||||
"name": "nvarchar",
|
||||
"nullable": true,
|
||||
"args": [
|
||||
{
|
||||
"ident": "max"
|
||||
}
|
||||
]
|
||||
},
|
||||
"table": "authors"
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"column": {
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "authors"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "FilterAuthors",
|
||||
"cmd": ":many",
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "authors"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "nvarchar",
|
||||
"args": [
|
||||
{
|
||||
"int": 100
|
||||
}
|
||||
]
|
||||
},
|
||||
"table": "authors"
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"column": {
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "nvarchar",
|
||||
"args": [
|
||||
{
|
||||
"int": 100
|
||||
}
|
||||
]
|
||||
},
|
||||
"table": "authors"
|
||||
}
|
||||
},
|
||||
{
|
||||
"number": 2,
|
||||
"column": {
|
||||
"name": "royalties",
|
||||
"type": {
|
||||
"name": "decimal",
|
||||
"args": [
|
||||
{
|
||||
"int": 10
|
||||
},
|
||||
{
|
||||
"int": 2
|
||||
}
|
||||
]
|
||||
},
|
||||
"table": "authors"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
5
internal/endtoend/testdata/analyze_params/mysql/exec.json
vendored
Normal file
5
internal/endtoend/testdata/analyze_params/mysql/exec.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"command": "analyze",
|
||||
"args": ["--dialect", "mysql", "--schema", "schema.sql", "query.sql"],
|
||||
"contexts": ["base"]
|
||||
}
|
||||
8
internal/endtoend/testdata/analyze_params/mysql/query.sql
vendored
Normal file
8
internal/endtoend/testdata/analyze_params/mysql/query.sql
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
-- name: GetUser :one
|
||||
SELECT id, name FROM users WHERE id = ?;
|
||||
|
||||
-- name: FilterUsers :many
|
||||
SELECT id, name FROM users WHERE name = sqlc.arg(name) AND bio = sqlc.narg(bio);
|
||||
|
||||
-- name: UsersByID :many
|
||||
SELECT id, name FROM users WHERE id IN (sqlc.slice(ids));
|
||||
12
internal/endtoend/testdata/analyze_params/mysql/schema.sql
vendored
Normal file
12
internal/endtoend/testdata/analyze_params/mysql/schema.sql
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
CREATE TABLE users (
|
||||
id BIGINT PRIMARY KEY,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
bio TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE posts (
|
||||
id BIGINT PRIMARY KEY,
|
||||
user_id BIGINT NOT NULL,
|
||||
title VARCHAR(255),
|
||||
created DATETIME NOT NULL
|
||||
);
|
||||
129
internal/endtoend/testdata/analyze_params/mysql/stdout.json
vendored
Normal file
129
internal/endtoend/testdata/analyze_params/mysql/stdout.json
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
[
|
||||
{
|
||||
"name": "GetUser",
|
||||
"cmd": ":one",
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "users"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "varchar",
|
||||
"args": [
|
||||
{
|
||||
"int": 255
|
||||
}
|
||||
]
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"column": {
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "FilterUsers",
|
||||
"cmd": ":many",
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "users"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "varchar",
|
||||
"args": [
|
||||
{
|
||||
"int": 255
|
||||
}
|
||||
]
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"column": {
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "varchar",
|
||||
"args": [
|
||||
{
|
||||
"int": 255
|
||||
}
|
||||
]
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
},
|
||||
{
|
||||
"number": 2,
|
||||
"column": {
|
||||
"name": "bio",
|
||||
"type": {
|
||||
"name": "text",
|
||||
"nullable": true
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "UsersByID",
|
||||
"cmd": ":many",
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "users"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "varchar",
|
||||
"args": [
|
||||
{
|
||||
"int": 255
|
||||
}
|
||||
]
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"column": {
|
||||
"name": "ids",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
5
internal/endtoend/testdata/analyze_params/postgresql/exec.json
vendored
Normal file
5
internal/endtoend/testdata/analyze_params/postgresql/exec.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"command": "analyze",
|
||||
"args": ["--dialect", "postgresql", "--schema", "schema.sql", "query.sql"],
|
||||
"contexts": ["base"]
|
||||
}
|
||||
11
internal/endtoend/testdata/analyze_params/postgresql/query.sql
vendored
Normal file
11
internal/endtoend/testdata/analyze_params/postgresql/query.sql
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
-- name: GetUser :one
|
||||
SELECT id, name FROM users WHERE id = $1;
|
||||
|
||||
-- name: FilterUsers :many
|
||||
SELECT id, name FROM users WHERE name = sqlc.arg(name) AND bio = sqlc.narg(bio);
|
||||
|
||||
-- name: UsersByID :many
|
||||
SELECT id, name FROM users WHERE id = ANY(sqlc.slice(ids));
|
||||
|
||||
-- name: PostsBetween :many
|
||||
SELECT id, title FROM posts WHERE created BETWEEN $1 AND $2;
|
||||
12
internal/endtoend/testdata/analyze_params/postgresql/schema.sql
vendored
Normal file
12
internal/endtoend/testdata/analyze_params/postgresql/schema.sql
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
CREATE TABLE users (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
name text NOT NULL,
|
||||
bio text
|
||||
);
|
||||
|
||||
CREATE TABLE posts (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
user_id bigint NOT NULL,
|
||||
title varchar(255),
|
||||
created timestamptz NOT NULL
|
||||
);
|
||||
157
internal/endtoend/testdata/analyze_params/postgresql/stdout.json
vendored
Normal file
157
internal/endtoend/testdata/analyze_params/postgresql/stdout.json
vendored
Normal file
@@ -0,0 +1,157 @@
|
||||
[
|
||||
{
|
||||
"name": "GetUser",
|
||||
"cmd": ":one",
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "users"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "text"
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"column": {
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "FilterUsers",
|
||||
"cmd": ":many",
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "users"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "text"
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"column": {
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "text"
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
},
|
||||
{
|
||||
"number": 2,
|
||||
"column": {
|
||||
"name": "bio",
|
||||
"type": {
|
||||
"name": "text",
|
||||
"nullable": true
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "UsersByID",
|
||||
"cmd": ":many",
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "users"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "text"
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"column": {
|
||||
"name": "ids",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "PostsBetween",
|
||||
"cmd": ":many",
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "bigint"
|
||||
},
|
||||
"table": "posts"
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": {
|
||||
"name": "character varying",
|
||||
"nullable": true,
|
||||
"args": [
|
||||
{
|
||||
"int": 255
|
||||
}
|
||||
]
|
||||
},
|
||||
"table": "posts"
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"column": {
|
||||
"name": "created",
|
||||
"type": {
|
||||
"name": "timestamp with time zone"
|
||||
},
|
||||
"table": "posts"
|
||||
}
|
||||
},
|
||||
{
|
||||
"number": 2,
|
||||
"column": {
|
||||
"name": "created",
|
||||
"type": {
|
||||
"name": "timestamp with time zone"
|
||||
},
|
||||
"table": "posts"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
5
internal/endtoend/testdata/analyze_params/sqlite/exec.json
vendored
Normal file
5
internal/endtoend/testdata/analyze_params/sqlite/exec.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"command": "analyze",
|
||||
"args": ["--dialect", "sqlite", "--schema", "schema.sql", "query.sql"],
|
||||
"contexts": ["base"]
|
||||
}
|
||||
8
internal/endtoend/testdata/analyze_params/sqlite/query.sql
vendored
Normal file
8
internal/endtoend/testdata/analyze_params/sqlite/query.sql
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
-- name: GetUser :one
|
||||
SELECT id, name FROM users WHERE id = ?;
|
||||
|
||||
-- name: FilterUsers :many
|
||||
SELECT id, name FROM users WHERE name = sqlc.arg(name) AND bio = sqlc.narg(bio);
|
||||
|
||||
-- name: CountPosts :one
|
||||
SELECT count(*) AS total FROM posts WHERE user_id = ?;
|
||||
12
internal/endtoend/testdata/analyze_params/sqlite/schema.sql
vendored
Normal file
12
internal/endtoend/testdata/analyze_params/sqlite/schema.sql
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
CREATE TABLE users (
|
||||
id INTEGER PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
bio TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE posts (
|
||||
id INTEGER PRIMARY KEY,
|
||||
user_id INTEGER NOT NULL,
|
||||
title TEXT,
|
||||
created TEXT NOT NULL
|
||||
);
|
||||
101
internal/endtoend/testdata/analyze_params/sqlite/stdout.json
vendored
Normal file
101
internal/endtoend/testdata/analyze_params/sqlite/stdout.json
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
[
|
||||
{
|
||||
"name": "GetUser",
|
||||
"cmd": ":one",
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "integer"
|
||||
},
|
||||
"table": "users"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "text"
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"column": {
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "integer"
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "FilterUsers",
|
||||
"cmd": ":many",
|
||||
"columns": [
|
||||
{
|
||||
"name": "id",
|
||||
"type": {
|
||||
"name": "integer"
|
||||
},
|
||||
"table": "users"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "text"
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"column": {
|
||||
"name": "name",
|
||||
"type": {
|
||||
"name": "text"
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
},
|
||||
{
|
||||
"number": 2,
|
||||
"column": {
|
||||
"name": "bio",
|
||||
"type": {
|
||||
"name": "text",
|
||||
"nullable": true
|
||||
},
|
||||
"table": "users"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "CountPosts",
|
||||
"cmd": ":one",
|
||||
"columns": [
|
||||
{
|
||||
"name": "total",
|
||||
"type": {
|
||||
"name": "integer"
|
||||
}
|
||||
}
|
||||
],
|
||||
"params": [
|
||||
{
|
||||
"number": 1,
|
||||
"column": {
|
||||
"name": "user_id",
|
||||
"type": {
|
||||
"name": "integer"
|
||||
},
|
||||
"table": "posts"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user