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:
1
internal/endtoend/testdata/func_out_param/issue.md
vendored
Normal file
1
internal/endtoend/testdata/func_out_param/issue.md
vendored
Normal file
@@ -0,0 +1 @@
|
||||
https://github.com/sqlc-dev/sqlc/issues/1654
|
||||
32
internal/endtoend/testdata/func_out_param/pgx/go/db.go
vendored
Normal file
32
internal/endtoend/testdata/func_out_param/pgx/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,
|
||||
}
|
||||
}
|
||||
15
internal/endtoend/testdata/func_out_param/pgx/go/models.go
vendored
Normal file
15
internal/endtoend/testdata/func_out_param/pgx/go/models.go
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
|
||||
package querytest
|
||||
|
||||
import (
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
type Author struct {
|
||||
ID int64
|
||||
Name string
|
||||
Bio pgtype.Text
|
||||
}
|
||||
30
internal/endtoend/testdata/func_out_param/pgx/go/query.sql.go
vendored
Normal file
30
internal/endtoend/testdata/func_out_param/pgx/go/query.sql.go
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
// 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 createAuthor = `-- name: CreateAuthor :one
|
||||
SELECT id FROM add_author (
|
||||
$1, $2
|
||||
)
|
||||
`
|
||||
|
||||
type CreateAuthorParams struct {
|
||||
Name string
|
||||
Bio string
|
||||
}
|
||||
|
||||
func (q *Queries) CreateAuthor(ctx context.Context, arg CreateAuthorParams) (pgtype.Int4, error) {
|
||||
row := q.db.QueryRow(ctx, createAuthor, arg.Name, arg.Bio)
|
||||
var id pgtype.Int4
|
||||
err := row.Scan(&id)
|
||||
return id, err
|
||||
}
|
||||
4
internal/endtoend/testdata/func_out_param/pgx/query.sql
vendored
Normal file
4
internal/endtoend/testdata/func_out_param/pgx/query.sql
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
-- name: CreateAuthor :one
|
||||
SELECT * FROM add_author (
|
||||
sqlc.arg(name), sqlc.arg(bio)
|
||||
);
|
||||
14
internal/endtoend/testdata/func_out_param/pgx/schema.sql
vendored
Normal file
14
internal/endtoend/testdata/func_out_param/pgx/schema.sql
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
-- Example queries for sqlc
|
||||
CREATE TABLE authors (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
name text NOT NULL,
|
||||
bio text
|
||||
);
|
||||
|
||||
CREATE OR REPLACE FUNCTION add_author (name text, bio text, out id int)
|
||||
AS $$
|
||||
DECLARE
|
||||
BEGIN
|
||||
id = 123;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
10
internal/endtoend/testdata/func_out_param/pgx/sqlc.yaml
vendored
Normal file
10
internal/endtoend/testdata/func_out_param/pgx/sqlc.yaml
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
version: "2"
|
||||
sql:
|
||||
- engine: "postgresql"
|
||||
schema: "schema.sql"
|
||||
queries: "query.sql"
|
||||
gen:
|
||||
go:
|
||||
package: "querytest"
|
||||
out: "go"
|
||||
sql_package: "pgx/v5"
|
||||
Reference in New Issue
Block a user