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:
31
internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/db.go
vendored
Normal file
31
internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/db.go
vendored
Normal 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,
|
||||
}
|
||||
}
|
||||
16
internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/models.go
vendored
Normal file
16
internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/models.go
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
|
||||
package querytest
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
type Author struct {
|
||||
ID int64
|
||||
Name string
|
||||
Bio sql.NullString
|
||||
CountryCode string
|
||||
}
|
||||
18
internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/querier.go
vendored
Normal file
18
internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/querier.go
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
|
||||
package querytest
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type Querier interface {
|
||||
CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error)
|
||||
DeleteAuthor(ctx context.Context, arg DeleteAuthorParams) error
|
||||
GetAuthor(ctx context.Context, arg GetAuthorParams) (Author, error)
|
||||
ListAuthors(ctx context.Context) ([]Author, error)
|
||||
}
|
||||
|
||||
var _ Querier = (*Queries)(nil)
|
||||
107
internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/query.sql.go
vendored
Normal file
107
internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/go/query.sql.go
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
// source: query.sql
|
||||
|
||||
package querytest
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
const createAuthor = `-- name: CreateAuthor :one
|
||||
INSERT INTO authors (
|
||||
name, bio, country_code
|
||||
) VALUES (
|
||||
$1, $2, $3
|
||||
)
|
||||
RETURNING id, name, bio, country_code
|
||||
`
|
||||
|
||||
type CreateAuthorParams struct {
|
||||
Name string
|
||||
Bio sql.NullString
|
||||
CountryCode string
|
||||
}
|
||||
|
||||
func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (Author, error) {
|
||||
row := q.db.QueryRowContext(ctx, createAuthor, arg.Name, arg.Bio, arg.CountryCode)
|
||||
var i Author
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Name,
|
||||
&i.Bio,
|
||||
&i.CountryCode,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const deleteAuthor = `-- name: DeleteAuthor :exec
|
||||
DELETE FROM authors
|
||||
WHERE id = $1
|
||||
`
|
||||
|
||||
type DeleteAuthorParams struct {
|
||||
ID int64
|
||||
}
|
||||
|
||||
func (q *Queries) DeleteAuthor(ctx context.Context, arg DeleteAuthorParams) error {
|
||||
_, err := q.db.ExecContext(ctx, deleteAuthor, arg.ID)
|
||||
return err
|
||||
}
|
||||
|
||||
const getAuthor = `-- name: GetAuthor :one
|
||||
SELECT id, name, bio, country_code FROM authors
|
||||
WHERE name = $1 AND country_code = $2 LIMIT 1
|
||||
`
|
||||
|
||||
type GetAuthorParams struct {
|
||||
Name string
|
||||
CountryCode string
|
||||
}
|
||||
|
||||
func (q *Queries) GetAuthor(ctx context.Context, arg GetAuthorParams) (Author, error) {
|
||||
row := q.db.QueryRowContext(ctx, getAuthor, arg.Name, arg.CountryCode)
|
||||
var i Author
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Name,
|
||||
&i.Bio,
|
||||
&i.CountryCode,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const listAuthors = `-- name: ListAuthors :many
|
||||
SELECT id, name, bio, country_code FROM authors
|
||||
ORDER BY name
|
||||
`
|
||||
|
||||
func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error) {
|
||||
rows, err := q.db.QueryContext(ctx, listAuthors)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
var items []Author
|
||||
for rows.Next() {
|
||||
var i Author
|
||||
if err := rows.Scan(
|
||||
&i.ID,
|
||||
&i.Name,
|
||||
&i.Bio,
|
||||
&i.CountryCode,
|
||||
); 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
|
||||
}
|
||||
19
internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/query.sql
vendored
Normal file
19
internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/query.sql
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
-- name: GetAuthor :one
|
||||
SELECT * FROM authors
|
||||
WHERE name = $1 AND country_code = $2 LIMIT 1;
|
||||
|
||||
-- name: ListAuthors :many
|
||||
SELECT * FROM authors
|
||||
ORDER BY name;
|
||||
|
||||
-- name: CreateAuthor :one
|
||||
INSERT INTO authors (
|
||||
name, bio, country_code
|
||||
) VALUES (
|
||||
$1, $2, $3
|
||||
)
|
||||
RETURNING *;
|
||||
|
||||
-- name: DeleteAuthor :exec
|
||||
DELETE FROM authors
|
||||
WHERE id = $1;
|
||||
8
internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/schema.sql
vendored
Normal file
8
internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/schema.sql
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Example queries for sqlc
|
||||
CREATE TABLE authors (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
name text NOT NULL,
|
||||
bio text,
|
||||
country_code CHAR(2) NOT NULL
|
||||
);
|
||||
|
||||
15
internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/sqlc.json
vendored
Normal file
15
internal/endtoend/testdata/query_parameter_limit_to_zero/postgresql/sqlc.json
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"version": "1",
|
||||
"packages": [
|
||||
{
|
||||
"path": "go",
|
||||
"engine": "postgresql",
|
||||
"name": "querytest",
|
||||
"schema": "schema.sql",
|
||||
"queries": "query.sql",
|
||||
"query_parameter_limit": 0,
|
||||
"emit_interface": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user