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/schema_table_column_ref/issue.md
vendored
Normal file
1
internal/endtoend/testdata/schema_table_column_ref/issue.md
vendored
Normal file
@@ -0,0 +1 @@
|
||||
https://github.com/sqlc-dev/sqlc/issues/2948
|
||||
32
internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/db.go
vendored
Normal file
32
internal/endtoend/testdata/schema_table_column_ref/postgresql/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,
|
||||
}
|
||||
}
|
||||
23
internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/models.go
vendored
Normal file
23
internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/models.go
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
|
||||
package querytest
|
||||
|
||||
import (
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
type AstoriaSlackFeedback struct {
|
||||
ID int64
|
||||
WorkspaceID int64
|
||||
CreatedAt pgtype.Timestamp
|
||||
IssueRaised pgtype.Bool
|
||||
}
|
||||
|
||||
type AstoriaTicket struct {
|
||||
ID int64
|
||||
WorkspaceID int64
|
||||
CreatedAt pgtype.Timestamp
|
||||
Source string
|
||||
}
|
||||
77
internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/query.sql.go
vendored
Normal file
77
internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/go/query.sql.go
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
// 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 getTotalSlackQueries = `-- name: GetTotalSlackQueries :one
|
||||
SELECT
|
||||
COUNT(*) AS count
|
||||
FROM astoria.slack_feedback
|
||||
WHERE astoria.slack_feedback.workspace_id = $1
|
||||
AND created_at BETWEEN $2::date AND $3::date
|
||||
`
|
||||
|
||||
type GetTotalSlackQueriesParams struct {
|
||||
WorkspaceID int64
|
||||
Column2 pgtype.Date
|
||||
Column3 pgtype.Date
|
||||
}
|
||||
|
||||
func (q *Queries) GetTotalSlackQueries(ctx context.Context, arg GetTotalSlackQueriesParams) (int64, error) {
|
||||
row := q.db.QueryRow(ctx, getTotalSlackQueries, arg.WorkspaceID, arg.Column2, arg.Column3)
|
||||
var count int64
|
||||
err := row.Scan(&count)
|
||||
return count, err
|
||||
}
|
||||
|
||||
const getTotalSlackQueriesRequestsCreated = `-- name: GetTotalSlackQueriesRequestsCreated :one
|
||||
SELECT
|
||||
COUNT(*) AS count
|
||||
FROM astoria.tickets
|
||||
WHERE astoria.tickets.workspace_id = $1
|
||||
AND source = 'RAISED_FROM_BOT'
|
||||
AND created_at BETWEEN $2::date AND $3::date
|
||||
`
|
||||
|
||||
type GetTotalSlackQueriesRequestsCreatedParams struct {
|
||||
WorkspaceID int64
|
||||
Column2 pgtype.Date
|
||||
Column3 pgtype.Date
|
||||
}
|
||||
|
||||
func (q *Queries) GetTotalSlackQueriesRequestsCreated(ctx context.Context, arg GetTotalSlackQueriesRequestsCreatedParams) (int64, error) {
|
||||
row := q.db.QueryRow(ctx, getTotalSlackQueriesRequestsCreated, arg.WorkspaceID, arg.Column2, arg.Column3)
|
||||
var count int64
|
||||
err := row.Scan(&count)
|
||||
return count, err
|
||||
}
|
||||
|
||||
const getTotalSlackQueriesResolved = `-- name: GetTotalSlackQueriesResolved :one
|
||||
SELECT
|
||||
COUNT(*) AS count
|
||||
FROM astoria.slack_feedback
|
||||
WHERE astoria.slack_feedback.workspace_id = $1
|
||||
AND (issue_raised = false OR issue_raised IS NULL)
|
||||
AND created_at BETWEEN $2::date AND $3::date
|
||||
`
|
||||
|
||||
type GetTotalSlackQueriesResolvedParams struct {
|
||||
WorkspaceID int64
|
||||
Column2 pgtype.Date
|
||||
Column3 pgtype.Date
|
||||
}
|
||||
|
||||
func (q *Queries) GetTotalSlackQueriesResolved(ctx context.Context, arg GetTotalSlackQueriesResolvedParams) (int64, error) {
|
||||
row := q.db.QueryRow(ctx, getTotalSlackQueriesResolved, arg.WorkspaceID, arg.Column2, arg.Column3)
|
||||
var count int64
|
||||
err := row.Scan(&count)
|
||||
return count, err
|
||||
}
|
||||
22
internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/query.sql
vendored
Normal file
22
internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/query.sql
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
-- name: GetTotalSlackQueries :one
|
||||
SELECT
|
||||
COUNT(*) AS count
|
||||
FROM astoria.slack_feedback
|
||||
WHERE astoria.slack_feedback.workspace_id = $1
|
||||
AND created_at BETWEEN $2::date AND $3::date;
|
||||
|
||||
-- name: GetTotalSlackQueriesResolved :one
|
||||
SELECT
|
||||
COUNT(*) AS count
|
||||
FROM astoria.slack_feedback
|
||||
WHERE astoria.slack_feedback.workspace_id = $1
|
||||
AND (issue_raised = false OR issue_raised IS NULL)
|
||||
AND created_at BETWEEN $2::date AND $3::date;
|
||||
|
||||
-- name: GetTotalSlackQueriesRequestsCreated :one
|
||||
SELECT
|
||||
COUNT(*) AS count
|
||||
FROM astoria.tickets
|
||||
WHERE astoria.tickets.workspace_id = $1
|
||||
AND source = 'RAISED_FROM_BOT'
|
||||
AND created_at BETWEEN $2::date AND $3::date;
|
||||
15
internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/schema.sql
vendored
Normal file
15
internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/schema.sql
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
CREATE SCHEMA astoria;
|
||||
|
||||
CREATE TABLE astoria.slack_feedback (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
workspace_id BIGINT NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL,
|
||||
issue_raised BOOLEAN
|
||||
);
|
||||
|
||||
CREATE TABLE astoria.tickets (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
workspace_id BIGINT NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL,
|
||||
source text NOT NULL
|
||||
);
|
||||
10
internal/endtoend/testdata/schema_table_column_ref/postgresql/pgx/sqlc.yaml
vendored
Normal file
10
internal/endtoend/testdata/schema_table_column_ref/postgresql/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