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

package querytest

import (
	"context"
)

const deleteTblFt = `-- name: DeleteTblFt :exec
DELETE FROM tbl_ft WHERE b = ?
`

func (q *Queries) DeleteTblFt(ctx context.Context, b string) error {
	_, err := q.db.ExecContext(ctx, deleteTblFt, b)
	return err
}

const insertTblFt = `-- name: InsertTblFt :exec
INSERT INTO tbl_ft(b, c) VALUES(?, ?)
`

type InsertTblFtParams struct {
	B string
	C string
}

func (q *Queries) InsertTblFt(ctx context.Context, arg InsertTblFtParams) error {
	_, err := q.db.ExecContext(ctx, insertTblFt, arg.B, arg.C)
	return err
}

const selectAllColsFt = `-- name: SelectAllColsFt :many
SELECT b FROM ft
WHERE b MATCH ?
`

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

const selectAllColsTblFt = `-- name: SelectAllColsTblFt :many
SELECT b, c FROM tbl_ft
WHERE b MATCH ?
`

func (q *Queries) SelectAllColsTblFt(ctx context.Context, b string) ([]TblFt, error) {
	rows, err := q.db.QueryContext(ctx, selectAllColsTblFt, b)
	if err != nil {
		return nil, err
	}
	defer rows.Close()
	var items []TblFt
	for rows.Next() {
		var i TblFt
		if err := rows.Scan(&i.B, &i.C); 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 selectBm25Func = `-- name: SelectBm25Func :many
SELECT b, c, bm25(tbl_ft, 2.0) FROM tbl_ft
WHERE b MATCH ? ORDER BY bm25(tbl_ft)
`

type SelectBm25FuncRow struct {
	B    string
	C    string
	Bm25 float64
}

func (q *Queries) SelectBm25Func(ctx context.Context, b string) ([]SelectBm25FuncRow, error) {
	rows, err := q.db.QueryContext(ctx, selectBm25Func, b)
	if err != nil {
		return nil, err
	}
	defer rows.Close()
	var items []SelectBm25FuncRow
	for rows.Next() {
		var i SelectBm25FuncRow
		if err := rows.Scan(&i.B, &i.C, &i.Bm25); 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 selectHightlighFunc = `-- name: SelectHightlighFunc :many
SELECT highlight(tbl_ft, 0, '<b>', '</b>') FROM tbl_ft
WHERE b MATCH ?
`

func (q *Queries) SelectHightlighFunc(ctx context.Context, b string) ([]string, error) {
	rows, err := q.db.QueryContext(ctx, selectHightlighFunc, b)
	if err != nil {
		return nil, err
	}
	defer rows.Close()
	var items []string
	for rows.Next() {
		var highlight string
		if err := rows.Scan(&highlight); err != nil {
			return nil, err
		}
		items = append(items, highlight)
	}
	if err := rows.Close(); err != nil {
		return nil, err
	}
	if err := rows.Err(); err != nil {
		return nil, err
	}
	return items, nil
}

const selectOneColFt = `-- name: SelectOneColFt :many
SELECT b FROM ft
WHERE b = ?
`

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

const selectOneColTblFt = `-- name: SelectOneColTblFt :many
SELECT c FROM tbl_ft
WHERE b = ?
`

func (q *Queries) SelectOneColTblFt(ctx context.Context, b string) ([]string, error) {
	rows, err := q.db.QueryContext(ctx, selectOneColTblFt, b)
	if err != nil {
		return nil, err
	}
	defer rows.Close()
	var items []string
	for rows.Next() {
		var c string
		if err := rows.Scan(&c); err != nil {
			return nil, err
		}
		items = append(items, c)
	}
	if err := rows.Close(); err != nil {
		return nil, err
	}
	if err := rows.Err(); err != nil {
		return nil, err
	}
	return items, nil
}

const selectSnippetFunc = `-- name: SelectSnippetFunc :many
SELECT snippet(tbl_ft, 0, '<b>', '</b>', 'aa', ?) FROM tbl_ft
`

func (q *Queries) SelectSnippetFunc(ctx context.Context, snippet int64) ([]string, error) {
	rows, err := q.db.QueryContext(ctx, selectSnippetFunc, snippet)
	if err != nil {
		return nil, err
	}
	defer rows.Close()
	var items []string
	for rows.Next() {
		var snippet string
		if err := rows.Scan(&snippet); err != nil {
			return nil, err
		}
		items = append(items, snippet)
	}
	if err := rows.Close(); err != nil {
		return nil, err
	}
	if err := rows.Err(); err != nil {
		return nil, err
	}
	return items, nil
}

const updateTblFt = `-- name: UpdateTblFt :exec
UPDATE tbl_ft SET c = ? WHERE b = ?
`

type UpdateTblFtParams struct {
	C string
	B string
}

func (q *Queries) UpdateTblFt(ctx context.Context, arg UpdateTblFtParams) error {
	_, err := q.db.ExecContext(ctx, updateTblFt, arg.C, arg.B)
	return err
}
