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:
32
internal/endtoend/testdata/func_args/pgx/v5/go/db.go
vendored
Normal file
32
internal/endtoend/testdata/func_args/pgx/v5/go/db.go
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
|
||||
package querytest
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/jackc/pgx/v5"
|
||||
"github.com/jackc/pgx/v5/pgconn"
|
||||
)
|
||||
|
||||
type DBTX interface {
|
||||
Exec(context.Context, string, ...any) (pgconn.CommandTag, error)
|
||||
Query(context.Context, string, ...any) (pgx.Rows, error)
|
||||
QueryRow(context.Context, string, ...any) pgx.Row
|
||||
}
|
||||
|
||||
func New(db DBTX) *Queries {
|
||||
return &Queries{db: db}
|
||||
}
|
||||
|
||||
type Queries struct {
|
||||
db DBTX
|
||||
}
|
||||
|
||||
func (q *Queries) WithTx(tx pgx.Tx) *Queries {
|
||||
return &Queries{
|
||||
db: tx,
|
||||
}
|
||||
}
|
||||
5
internal/endtoend/testdata/func_args/pgx/v5/go/models.go
vendored
Normal file
5
internal/endtoend/testdata/func_args/pgx/v5/go/models.go
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
|
||||
package querytest
|
||||
72
internal/endtoend/testdata/func_args/pgx/v5/go/query.sql.go
vendored
Normal file
72
internal/endtoend/testdata/func_args/pgx/v5/go/query.sql.go
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
// source: query.sql
|
||||
|
||||
package querytest
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
const makeIntervalDays = `-- name: MakeIntervalDays :one
|
||||
SELECT make_interval(days => $1::int)
|
||||
`
|
||||
|
||||
func (q *Queries) MakeIntervalDays(ctx context.Context, dollar_1 int32) (pgtype.Interval, error) {
|
||||
row := q.db.QueryRow(ctx, makeIntervalDays, dollar_1)
|
||||
var make_interval pgtype.Interval
|
||||
err := row.Scan(&make_interval)
|
||||
return make_interval, err
|
||||
}
|
||||
|
||||
const makeIntervalMonths = `-- name: MakeIntervalMonths :one
|
||||
SELECT make_interval(months => $1::int)
|
||||
`
|
||||
|
||||
func (q *Queries) MakeIntervalMonths(ctx context.Context, months int32) (pgtype.Interval, error) {
|
||||
row := q.db.QueryRow(ctx, makeIntervalMonths, months)
|
||||
var make_interval pgtype.Interval
|
||||
err := row.Scan(&make_interval)
|
||||
return make_interval, err
|
||||
}
|
||||
|
||||
const makeIntervalSecs = `-- name: MakeIntervalSecs :one
|
||||
SELECT make_interval(secs => $1)
|
||||
`
|
||||
|
||||
func (q *Queries) MakeIntervalSecs(ctx context.Context, secs float64) (pgtype.Interval, error) {
|
||||
row := q.db.QueryRow(ctx, makeIntervalSecs, secs)
|
||||
var make_interval pgtype.Interval
|
||||
err := row.Scan(&make_interval)
|
||||
return make_interval, err
|
||||
}
|
||||
|
||||
const plus = `-- name: Plus :one
|
||||
SELECT plus(b => $2, a => $1)
|
||||
`
|
||||
|
||||
type PlusParams struct {
|
||||
A int32
|
||||
B int32
|
||||
}
|
||||
|
||||
func (q *Queries) Plus(ctx context.Context, arg PlusParams) (int32, error) {
|
||||
row := q.db.QueryRow(ctx, plus, arg.A, arg.B)
|
||||
var plus int32
|
||||
err := row.Scan(&plus)
|
||||
return plus, err
|
||||
}
|
||||
|
||||
const tableArgs = `-- name: TableArgs :one
|
||||
SELECT table_args(x => $1)
|
||||
`
|
||||
|
||||
func (q *Queries) TableArgs(ctx context.Context, x int32) (int32, error) {
|
||||
row := q.db.QueryRow(ctx, tableArgs, x)
|
||||
var table_args int32
|
||||
err := row.Scan(&table_args)
|
||||
return table_args, err
|
||||
}
|
||||
14
internal/endtoend/testdata/func_args/pgx/v5/query.sql
vendored
Normal file
14
internal/endtoend/testdata/func_args/pgx/v5/query.sql
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
-- name: Plus :one
|
||||
SELECT plus(b => $2, a => $1);
|
||||
|
||||
-- name: MakeIntervalSecs :one
|
||||
SELECT make_interval(secs => $1);
|
||||
|
||||
-- name: MakeIntervalDays :one
|
||||
SELECT make_interval(days => $1::int);
|
||||
|
||||
-- name: MakeIntervalMonths :one
|
||||
SELECT make_interval(months => sqlc.arg('months')::int);
|
||||
|
||||
-- name: TableArgs :one
|
||||
SELECT table_args(x => $1);
|
||||
8
internal/endtoend/testdata/func_args/pgx/v5/schema.sql
vendored
Normal file
8
internal/endtoend/testdata/func_args/pgx/v5/schema.sql
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
CREATE FUNCTION plus(a integer, b integer) RETURNS integer AS $$
|
||||
BEGIN
|
||||
RETURN a + b;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE FUNCTION table_args(x INT) RETURNS TABLE (y INT) AS 'SELECT x' LANGUAGE sql;
|
||||
|
||||
13
internal/endtoend/testdata/func_args/pgx/v5/sqlc.json
vendored
Normal file
13
internal/endtoend/testdata/func_args/pgx/v5/sqlc.json
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"version": "1",
|
||||
"packages": [
|
||||
{
|
||||
"path": "go",
|
||||
"engine": "postgresql",
|
||||
"sql_package": "pgx/v5",
|
||||
"name": "querytest",
|
||||
"schema": "schema.sql",
|
||||
"queries": "query.sql"
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user