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