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

This commit is contained in:
upstream-mirror
2026-09-16 02:17:34 +05:00
commit 0f4df23290
7340 changed files with 238743 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
{
"command": "analyze",
"args": ["--dialect", "duckdb", "--schema", "schema.sql", "query.sql"],
"contexts": ["base"]
}

View 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;

View 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
);

View 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": []
}
]

View File

@@ -0,0 +1,5 @@
{
"command": "analyze",
"args": ["--dialect", "googlesql", "--schema", "schema.sql", "query.sql"],
"contexts": ["base"]
}

View File

@@ -0,0 +1,8 @@
-- 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 = @name;

View File

@@ -0,0 +1,12 @@
CREATE TABLE users (
id INT64 NOT NULL,
name STRING(MAX) NOT NULL,
bio STRING(MAX),
) PRIMARY KEY (id);
CREATE TABLE posts (
id INT64 NOT NULL,
user_id INT64 NOT NULL,
title STRING(255),
created TIMESTAMP NOT NULL,
) PRIMARY KEY (id);

View File

@@ -0,0 +1,123 @@
[
{
"name": "ListUsers",
"cmd": ":many",
"columns": [
{
"name": "id",
"type": {
"name": "int64"
},
"table": "users"
},
{
"name": "name",
"type": {
"name": "string",
"args": [
{
"ident": "max"
}
]
},
"table": "users"
},
{
"name": "bio",
"type": {
"name": "string",
"nullable": true,
"args": [
{
"ident": "max"
}
]
},
"table": "users"
}
],
"params": []
},
{
"name": "CountUsers",
"cmd": ":one",
"columns": [
{
"name": "total",
"type": {
"name": "int64"
}
}
],
"params": []
},
{
"name": "ListUserPosts",
"cmd": ":many",
"columns": [
{
"name": "name",
"type": {
"name": "string",
"args": [
{
"ident": "max"
}
]
},
"table": "users"
},
{
"name": "id",
"type": {
"name": "int64"
},
"table": "posts"
},
{
"name": "user_id",
"type": {
"name": "int64"
},
"table": "posts"
},
{
"name": "title",
"type": {
"name": "string",
"nullable": true,
"args": [
{
"int": 255
}
]
},
"table": "posts"
},
{
"name": "created",
"type": {
"name": "timestamp"
},
"table": "posts"
}
],
"params": [
{
"number": 1,
"column": {
"name": "name",
"type": {
"name": "string",
"args": [
{
"ident": "max"
}
]
},
"table": "users"
}
}
]
}
]

View File

@@ -0,0 +1,5 @@
{
"command": "analyze",
"args": ["--dialect", "mysql", "--schema", "schema.sql", "query.sql"],
"contexts": ["base"]
}

View File

@@ -0,0 +1,17 @@
-- 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 = ?;
-- name: SearchPosts :many
SELECT id, title FROM posts WHERE title LIKE ? AND created > ?;
-- name: LatestPostPerUser :many
WITH latest AS (
SELECT user_id, max(created) AS created FROM posts GROUP BY user_id
)
SELECT u.name, latest.created FROM users u JOIN latest ON latest.user_id = u.id;

View 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
);

View File

@@ -0,0 +1,198 @@
[
{
"name": "ListUsers",
"cmd": ":many",
"columns": [
{
"name": "id",
"type": {
"name": "bigint"
},
"table": "users"
},
{
"name": "name",
"type": {
"name": "varchar",
"args": [
{
"int": 255
}
]
},
"table": "users"
},
{
"name": "bio",
"type": {
"name": "text",
"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",
"args": [
{
"int": 255
}
]
},
"table": "users"
},
{
"name": "id",
"type": {
"name": "bigint"
},
"table": "posts"
},
{
"name": "user_id",
"type": {
"name": "bigint"
},
"table": "posts"
},
{
"name": "title",
"type": {
"name": "varchar",
"nullable": true,
"args": [
{
"int": 255
}
]
},
"table": "posts"
},
{
"name": "created",
"type": {
"name": "datetime"
},
"table": "posts"
}
],
"params": [
{
"number": 1,
"column": {
"name": "name",
"type": {
"name": "varchar",
"args": [
{
"int": 255
}
]
},
"table": "users"
}
}
]
},
{
"name": "SearchPosts",
"cmd": ":many",
"columns": [
{
"name": "id",
"type": {
"name": "bigint"
},
"table": "posts"
},
{
"name": "title",
"type": {
"name": "varchar",
"nullable": true,
"args": [
{
"int": 255
}
]
},
"table": "posts"
}
],
"params": [
{
"number": 1,
"column": {
"name": "title",
"type": {
"name": "varchar",
"nullable": true,
"args": [
{
"int": 255
}
]
},
"table": "posts"
}
},
{
"number": 2,
"column": {
"name": "created",
"type": {
"name": "datetime"
},
"table": "posts"
}
}
]
},
{
"name": "LatestPostPerUser",
"cmd": ":many",
"columns": [
{
"name": "name",
"type": {
"name": "varchar",
"args": [
{
"int": 255
}
]
},
"table": "users"
},
{
"name": "created",
"type": {
"name": "datetime",
"nullable": true
}
}
],
"params": []
}
]

View File

@@ -0,0 +1,5 @@
{
"command": "analyze",
"args": ["--dialect", "postgresql", "--schema", "schema.sql", "query.sql"],
"contexts": ["base"]
}

View File

@@ -0,0 +1,17 @@
-- 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: SearchPosts :many
SELECT id, title FROM posts WHERE title LIKE $1 AND created > $2;
-- name: LatestPostPerUser :many
WITH latest AS (
SELECT user_id, max(created) AS created FROM posts GROUP BY user_id
)
SELECT u.name, latest.created FROM users u JOIN latest ON latest.user_id = u.id;

View 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
);

View File

@@ -0,0 +1,177 @@
[
{
"name": "ListUsers",
"cmd": ":many",
"columns": [
{
"name": "id",
"type": {
"name": "bigint"
},
"table": "users"
},
{
"name": "name",
"type": {
"name": "text"
},
"table": "users"
},
{
"name": "bio",
"type": {
"name": "text",
"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": "text"
},
"table": "users"
},
{
"name": "id",
"type": {
"name": "bigint"
},
"table": "posts"
},
{
"name": "user_id",
"type": {
"name": "bigint"
},
"table": "posts"
},
{
"name": "title",
"type": {
"name": "character varying",
"nullable": true,
"args": [
{
"int": 255
}
]
},
"table": "posts"
},
{
"name": "created",
"type": {
"name": "timestamp with time zone"
},
"table": "posts"
}
],
"params": [
{
"number": 1,
"column": {
"name": "name",
"type": {
"name": "text"
},
"table": "users"
}
}
]
},
{
"name": "SearchPosts",
"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": "title",
"type": {
"name": "character varying",
"nullable": true,
"args": [
{
"int": 255
}
]
},
"table": "posts"
}
},
{
"number": 2,
"column": {
"name": "created",
"type": {
"name": "timestamp with time zone"
},
"table": "posts"
}
}
]
},
{
"name": "LatestPostPerUser",
"cmd": ":many",
"columns": [
{
"name": "name",
"type": {
"name": "text"
},
"table": "users"
},
{
"name": "created",
"type": {
"name": "timestamp with time zone"
}
}
],
"params": []
}
]

View File

@@ -0,0 +1,5 @@
{
"command": "analyze",
"args": ["--dialect", "sqlite", "--schema", "schema.sql", "query.sql"],
"contexts": ["base"]
}

View File

@@ -0,0 +1,11 @@
-- 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 = ?;
-- name: SearchPosts :many
SELECT id, title FROM posts WHERE title LIKE ? AND created > ?;

View 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
);

View File

@@ -0,0 +1,142 @@
[
{
"name": "ListUsers",
"cmd": ":many",
"columns": [
{
"name": "id",
"type": {
"name": "integer"
},
"table": "users"
},
{
"name": "name",
"type": {
"name": "text"
},
"table": "users"
},
{
"name": "bio",
"type": {
"name": "text",
"nullable": true
},
"table": "users"
}
],
"params": []
},
{
"name": "CountUsers",
"cmd": ":one",
"columns": [
{
"name": "total",
"type": {
"name": "integer"
}
}
],
"params": []
},
{
"name": "ListUserPosts",
"cmd": ":many",
"columns": [
{
"name": "name",
"type": {
"name": "text"
},
"table": "users"
},
{
"name": "id",
"type": {
"name": "integer"
},
"table": "posts"
},
{
"name": "user_id",
"type": {
"name": "integer"
},
"table": "posts"
},
{
"name": "title",
"type": {
"name": "text",
"nullable": true
},
"table": "posts"
},
{
"name": "created",
"type": {
"name": "text"
},
"table": "posts"
}
],
"params": [
{
"number": 1,
"column": {
"name": "name",
"type": {
"name": "text"
},
"table": "users"
}
}
]
},
{
"name": "SearchPosts",
"cmd": ":many",
"columns": [
{
"name": "id",
"type": {
"name": "integer"
},
"table": "posts"
},
{
"name": "title",
"type": {
"name": "text",
"nullable": true
},
"table": "posts"
}
],
"params": [
{
"number": 1,
"column": {
"name": "title",
"type": {
"name": "text",
"nullable": true
},
"table": "posts"
}
},
{
"number": 2,
"column": {
"name": "created",
"type": {
"name": "text"
},
"table": "posts"
}
}
]
}
]