// Code generated by sqlc. DO NOT EDIT.
// versions:
//   sqlc v1.21.0
// source: query.sql

package db

import (
	"context"
	"database/sql"
)

const query_param_enum_table = `-- name: query_param_enum_table :one
SELECT id, other, value FROM query_param_enum_table WHERE value = $1
`

func (q *Queries) query_param_enum_table(ctx context.Context, value NullQueryParamEnumTableEnum) (QueryParamEnumTable, error) {
	row := q.db.QueryRowContext(ctx, query_param_enum_table, value)
	var i QueryParamEnumTable
	err := row.Scan(&i.ID, &i.Other, &i.Value)
	return i, err
}

const query_param_struct_enum_table = `-- name: query_param_struct_enum_table :one
SELECT id FROM query_param_struct_enum_table WHERE id = $1 AND value = $2
`

type query_param_struct_enum_tableParams struct {
	ID    int32
	Value NullQueryParamStructEnumTableEnum
}

func (q *Queries) query_param_struct_enum_table(ctx context.Context, arg query_param_struct_enum_tableParams) (int32, error) {
	row := q.db.QueryRowContext(ctx, query_param_struct_enum_table, arg.ID, arg.Value)
	var id int32
	err := row.Scan(&id)
	return id, err
}

const query_return_enum_table = `-- name: query_return_enum_table :one
SELECT value FROM query_return_enum_table WHERE id = $1
`

func (q *Queries) query_return_enum_table(ctx context.Context, id int32) (NullQueryReturnEnumTableEnum, error) {
	row := q.db.QueryRowContext(ctx, query_return_enum_table, id)
	var value NullQueryReturnEnumTableEnum
	err := row.Scan(&value)
	return value, err
}

const query_return_full_table = `-- name: query_return_full_table :many
SELECT id, value FROM query_return_full_table
`

func (q *Queries) query_return_full_table(ctx context.Context) ([]QueryReturnFullTable, error) {
	rows, err := q.db.QueryContext(ctx, query_return_full_table)
	if err != nil {
		return nil, err
	}
	defer rows.Close()
	var items []QueryReturnFullTable
	for rows.Next() {
		var i QueryReturnFullTable
		if err := rows.Scan(&i.ID, &i.Value); err != nil {
			return nil, err
		}
		items = append(items, i)
	}
	if err := rows.Close(); err != nil {
		return nil, err
	}
	if err := rows.Err(); err != nil {
		return nil, err
	}
	return items, nil
}

const query_return_struct_enum_table = `-- name: query_return_struct_enum_table :one
SELECT value, another FROM query_return_struct_enum_table WHERE id = $1
`

type query_return_struct_enum_tableRow struct {
	Value   NullQueryReturnStructEnumTableEnum
	Another sql.NullInt32
}

func (q *Queries) query_return_struct_enum_table(ctx context.Context, id int32) (query_return_struct_enum_tableRow, error) {
	row := q.db.QueryRowContext(ctx, query_return_struct_enum_table, id)
	var i query_return_struct_enum_tableRow
	err := row.Scan(&i.Value, &i.Another)
	return i, err
}
