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,31 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
package querytest
import (
"context"
"database/sql"
)
type DBTX interface {
ExecContext(context.Context, string, ...any) (sql.Result, error)
PrepareContext(context.Context, string) (*sql.Stmt, error)
QueryContext(context.Context, string, ...any) (*sql.Rows, error)
QueryRowContext(context.Context, string, ...any) *sql.Row
}
func New(db DBTX) *Queries {
return &Queries{db: db}
}
type Queries struct {
db DBTX
}
func (q *Queries) WithTx(tx *sql.Tx) *Queries {
return &Queries{
db: tx,
}
}

View File

@@ -0,0 +1,34 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
package querytest
type A struct {
ID int64
A string
}
type B struct {
ID int64
B string
AID int64
}
type C struct {
ID int64
C string
AID int64
}
type D struct {
ID int64
D string
AID int64
}
type E struct {
ID int64
E string
AID int64
}

View File

@@ -0,0 +1,175 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
// source: query.sql
package querytest
import (
"context"
"database/sql"
)
const testInnerLeft = `-- name: TestInnerLeft :many
SELECT a.a, b.b, c.c
FROM a
INNER JOIN b ON b.a_id = a.id
LEFT JOIN c ON c.a_id = a.id
`
type TestInnerLeftRow struct {
A string
B string
C sql.NullString
}
func (q *Queries) TestInnerLeft(ctx context.Context) ([]TestInnerLeftRow, error) {
rows, err := q.db.QueryContext(ctx, testInnerLeft)
if err != nil {
return nil, err
}
defer rows.Close()
var items []TestInnerLeftRow
for rows.Next() {
var i TestInnerLeftRow
if err := rows.Scan(&i.A, &i.B, &i.C); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Close(); err != nil {
return nil, err
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const testInnerLeftInnerLeft = `-- name: TestInnerLeftInnerLeft :many
SELECT a.a, b.b, c.c, d.d, e.e
FROM a
INNER JOIN b ON b.a_id = a.id
LEFT JOIN c ON c.a_id = a.id
INNER JOIN d ON d.a_id = a.id
LEFT JOIN e ON e.a_id = a.id
`
type TestInnerLeftInnerLeftRow struct {
A string
B string
C sql.NullString
D string
E sql.NullString
}
func (q *Queries) TestInnerLeftInnerLeft(ctx context.Context) ([]TestInnerLeftInnerLeftRow, error) {
rows, err := q.db.QueryContext(ctx, testInnerLeftInnerLeft)
if err != nil {
return nil, err
}
defer rows.Close()
var items []TestInnerLeftInnerLeftRow
for rows.Next() {
var i TestInnerLeftInnerLeftRow
if err := rows.Scan(
&i.A,
&i.B,
&i.C,
&i.D,
&i.E,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Close(); err != nil {
return nil, err
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const testLeftInner = `-- name: TestLeftInner :many
SELECT a.a, b.b, c.c
FROM a
LEFT JOIN b ON b.a_id = a.id
INNER JOIN c ON c.a_id = a.id
`
type TestLeftInnerRow struct {
A string
B sql.NullString
C string
}
func (q *Queries) TestLeftInner(ctx context.Context) ([]TestLeftInnerRow, error) {
rows, err := q.db.QueryContext(ctx, testLeftInner)
if err != nil {
return nil, err
}
defer rows.Close()
var items []TestLeftInnerRow
for rows.Next() {
var i TestLeftInnerRow
if err := rows.Scan(&i.A, &i.B, &i.C); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Close(); err != nil {
return nil, err
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const testLeftInnerLeftInner = `-- name: TestLeftInnerLeftInner :many
SELECT a.a, b.b, c.c, d.d, e.e
FROM a
LEFT JOIN b ON b.a_id = a.id
INNER JOIN c ON c.a_id = a.id
LEFT JOIN d ON d.a_id = a.id
INNER JOIN e ON e.a_id = a.id
`
type TestLeftInnerLeftInnerRow struct {
A string
B sql.NullString
C string
D sql.NullString
E string
}
func (q *Queries) TestLeftInnerLeftInner(ctx context.Context) ([]TestLeftInnerLeftInnerRow, error) {
rows, err := q.db.QueryContext(ctx, testLeftInnerLeftInner)
if err != nil {
return nil, err
}
defer rows.Close()
var items []TestLeftInnerLeftInnerRow
for rows.Next() {
var i TestLeftInnerLeftInnerRow
if err := rows.Scan(
&i.A,
&i.B,
&i.C,
&i.D,
&i.E,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Close(); err != nil {
return nil, err
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}

View File

@@ -0,0 +1,27 @@
-- name: TestLeftInner :many
SELECT a.a, b.b, c.c
FROM a
LEFT JOIN b ON b.a_id = a.id
INNER JOIN c ON c.a_id = a.id;
-- name: TestInnerLeft :many
SELECT a.a, b.b, c.c
FROM a
INNER JOIN b ON b.a_id = a.id
LEFT JOIN c ON c.a_id = a.id;
-- name: TestLeftInnerLeftInner :many
SELECT a.a, b.b, c.c, d.d, e.e
FROM a
LEFT JOIN b ON b.a_id = a.id
INNER JOIN c ON c.a_id = a.id
LEFT JOIN d ON d.a_id = a.id
INNER JOIN e ON e.a_id = a.id;
-- name: TestInnerLeftInnerLeft :many
SELECT a.a, b.b, c.c, d.d, e.e
FROM a
INNER JOIN b ON b.a_id = a.id
LEFT JOIN c ON c.a_id = a.id
INNER JOIN d ON d.a_id = a.id
LEFT JOIN e ON e.a_id = a.id;

View File

@@ -0,0 +1,29 @@
CREATE TABLE a (
id BIGSERIAL PRIMARY KEY,
a TEXT NOT NULL
);
CREATE TABLE b (
id BIGSERIAL PRIMARY KEY,
b TEXT NOT NULL,
a_id BIGINT NOT NULL REFERENCES a (id)
);
CREATE TABLE c (
id BIGSERIAL PRIMARY KEY,
c TEXT NOT NULL,
a_id BIGINT NOT NULL REFERENCES a (id)
);
CREATE TABLE d (
id BIGSERIAL PRIMARY KEY,
d TEXT NOT NULL,
a_id BIGINT NOT NULL REFERENCES a (id)
);
CREATE TABLE e (
id BIGSERIAL PRIMARY KEY,
e TEXT NOT NULL,
a_id BIGINT NOT NULL REFERENCES a (id)
);

View File

@@ -0,0 +1,12 @@
{
"version": "1",
"packages": [
{
"path": "go",
"engine": "postgresql",
"name": "querytest",
"schema": "schema.sql",
"queries": "query.sql"
}
]
}