// Code generated by sqlc. DO NOT EDIT.
// versions:
//   sqlc v1.30.0
// source: excluded_paths.sql

package sqlcgen

import (
	"context"
)

const clearExcludedPaths = `-- name: ClearExcludedPaths :exec
DELETE FROM excluded_paths
`

func (q *Queries) ClearExcludedPaths(ctx context.Context) error {
	_, err := q.db.ExecContext(ctx, clearExcludedPaths)
	return err
}

const countExcludedPathsByLibrary = `-- name: CountExcludedPathsByLibrary :one
SELECT COUNT(*) FROM excluded_paths
WHERE library_id = ?
`

func (q *Queries) CountExcludedPathsByLibrary(ctx context.Context, libraryID int64) (int64, error) {
	row := q.db.QueryRowContext(ctx, countExcludedPathsByLibrary, libraryID)
	var count int64
	err := row.Scan(&count)
	return count, err
}

const excludePath = `-- name: ExcludePath :exec
INSERT INTO excluded_paths (library_id, file_path)
VALUES (?, ?)
ON CONFLICT(library_id, file_path) DO NOTHING
`

type ExcludePathParams struct {
	LibraryID int64
	FilePath  string
}

func (q *Queries) ExcludePath(ctx context.Context, arg ExcludePathParams) error {
	_, err := q.db.ExecContext(ctx, excludePath, arg.LibraryID, arg.FilePath)
	return err
}

const getExcludedPathsByLibrary = `-- name: GetExcludedPathsByLibrary :many
SELECT file_path FROM excluded_paths
WHERE library_id = ?
`

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