forked from sqlc-dev/sqlc
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathquery.sql.go
More file actions
44 lines (38 loc) · 878 Bytes
/
query.sql.go
File metadata and controls
44 lines (38 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.26.0
// source: query.sql
package querytest
import (
"context"
)
const cTEMultipleRefs = `-- name: CTEMultipleRefs :one
WITH t1_ids AS (
SELECT id FROM t1 WHERE t1.id = $1
),
t2_ids AS (
SELECT id FROM t2 WHERE t2.id = $1
),
all_ids AS (
SELECT id FROM t1_ids
UNION
SELECT id FROM t2_ids
)
SELECT id FROM all_ids AS ids WHERE ids.id = $1
`
func (q *Queries) CTEMultipleRefs(ctx context.Context, id int32) (int32, error) {
row := q.db.QueryRow(ctx, cTEMultipleRefs, id)
err := row.Scan(&id)
return id, err
}
const cTERef = `-- name: CTERef :one
WITH t1_ids AS (
SELECT id FROM t1
)
SELECT id FROM t1_ids WHERE t1_ids.id = $1
`
func (q *Queries) CTERef(ctx context.Context, id int32) (int32, error) {
row := q.db.QueryRow(ctx, cTERef, id)
err := row.Scan(&id)
return id, err
}