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
98 lines
2.1 KiB
Go
98 lines
2.1 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.31.1
|
|
// source: query.sql
|
|
|
|
package querytest
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
)
|
|
|
|
const selectUserByID = `-- name: SelectUserByID :many
|
|
SELECT first_name from
|
|
users where ($1 = id OR $1 = 0)
|
|
`
|
|
|
|
func (q *Queries) SelectUserByID(ctx context.Context, id int32) ([]sql.NullString, error) {
|
|
rows, err := q.db.QueryContext(ctx, selectUserByID, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []sql.NullString
|
|
for rows.Next() {
|
|
var first_name sql.NullString
|
|
if err := rows.Scan(&first_name); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, first_name)
|
|
}
|
|
if err := rows.Close(); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const selectUserByName = `-- name: SelectUserByName :many
|
|
SELECT first_name
|
|
FROM users
|
|
WHERE first_name = $1
|
|
OR last_name = $1
|
|
`
|
|
|
|
func (q *Queries) SelectUserByName(ctx context.Context, name sql.NullString) ([]sql.NullString, error) {
|
|
rows, err := q.db.QueryContext(ctx, selectUserByName, name)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []sql.NullString
|
|
for rows.Next() {
|
|
var first_name sql.NullString
|
|
if err := rows.Scan(&first_name); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, first_name)
|
|
}
|
|
if err := rows.Close(); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const selectUserQuestion = `-- name: SelectUserQuestion :many
|
|
SELECT first_name from
|
|
users where ($1 = id OR $1 = 0)
|
|
`
|
|
|
|
func (q *Queries) SelectUserQuestion(ctx context.Context, id int32) ([]sql.NullString, error) {
|
|
rows, err := q.db.QueryContext(ctx, selectUserQuestion, id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []sql.NullString
|
|
for rows.Next() {
|
|
var first_name sql.NullString
|
|
if err := rows.Scan(&first_name); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, first_name)
|
|
}
|
|
if err := rows.Close(); err != nil {
|
|
return nil, err
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|