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 db
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,90 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
package db
import (
"database/sql/driver"
"fmt"
)
type EnumType string
const (
EnumTypeBeforefirst EnumType = "beforefirst"
EnumTypeFirst EnumType = "first"
EnumTypeSecond EnumType = "second"
EnumTypeThird EnumType = "third"
EnumTypeFourth EnumType = "fourth"
EnumTypeFifth EnumType = "fifth"
EnumTypeLast EnumType = "last"
EnumTypeAfterlast EnumType = "afterlast"
)
func (e *EnumType) Scan(src any) error {
switch s := src.(type) {
case []byte:
*e = EnumType(s)
case string:
*e = EnumType(s)
default:
return fmt.Errorf("unsupported scan type for EnumType: %T", src)
}
return nil
}
type NullEnumType struct {
EnumType EnumType
Valid bool // Valid is true if EnumType is not NULL
}
// Scan implements the Scanner interface.
func (ns *NullEnumType) Scan(value any) error {
if value == nil {
ns.EnumType, ns.Valid = "", false
return nil
}
ns.Valid = true
return ns.EnumType.Scan(value)
}
// Value implements the driver Valuer interface.
func (ns NullEnumType) Value() (driver.Value, error) {
if !ns.Valid {
return nil, nil
}
return string(ns.EnumType), nil
}
func (e EnumType) Valid() bool {
switch e {
case EnumTypeBeforefirst,
EnumTypeFirst,
EnumTypeSecond,
EnumTypeThird,
EnumTypeFourth,
EnumTypeFifth,
EnumTypeLast,
EnumTypeAfterlast:
return true
}
return false
}
func AllEnumTypeValues() []EnumType {
return []EnumType{
EnumTypeBeforefirst,
EnumTypeFirst,
EnumTypeSecond,
EnumTypeThird,
EnumTypeFourth,
EnumTypeFifth,
EnumTypeLast,
EnumTypeAfterlast,
}
}
type Foo struct {
ID int32
}

View File

@@ -0,0 +1,15 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
package db
import (
"context"
)
type Querier interface {
GetAll(ctx context.Context) ([]int32, error)
}
var _ Querier = (*Queries)(nil)

View File

@@ -0,0 +1,37 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
// source: query.sql
package db
import (
"context"
)
const getAll = `-- name: GetAll :many
SELECT id FROM foo
`
func (q *Queries) GetAll(ctx context.Context) ([]int32, error) {
rows, err := q.db.QueryContext(ctx, getAll)
if err != nil {
return nil, err
}
defer rows.Close()
var items []int32
for rows.Next() {
var id int32
if err := rows.Scan(&id); err != nil {
return nil, err
}
items = append(items, id)
}
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,2 @@
-- name: GetAll :many
SELECT * FROM foo;

View File

@@ -0,0 +1,11 @@
CREATE TYPE enum_type AS ENUM ('first', 'last');
ALTER TYPE enum_type ADD VALUE 'afterlast' AFTER 'last';
ALTER TYPE enum_type ADD VALUE 'third' AFTER 'first';
ALTER TYPE enum_type ADD VALUE 'fourth' BEFORE 'last';
ALTER TYPE enum_type ADD VALUE 'fifth' AFTER 'fourth';
ALTER TYPE enum_type ADD VALUE 'second' BEFORE 'third';
ALTER TYPE enum_type ADD VALUE 'beforefirst' BEFORE 'first';
CREATE TABLE foo (
id SERIAL PRIMARY KEY
);

View File

@@ -0,0 +1,19 @@
{
"version": "2",
"sql": [
{
"engine": "postgresql",
"schema": "schema.sql",
"queries": "query.sql",
"gen": {
"go": {
"out" : "go",
"package" : "db",
"emit_interface": true,
"emit_all_enum_values": true,
"emit_enum_valid_method": true
}
}
}
]
}