// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.30.0 // source: libraries.sql package sqlcgen import ( "context" ) const ackLibraryAutotagWarning = `-- name: AckLibraryAutotagWarning :exec UPDATE libraries SET autotag_warning_acked = 1 WHERE id = ? ` func (q *Queries) AckLibraryAutotagWarning(ctx context.Context, id int64) error { _, err := q.db.ExecContext(ctx, ackLibraryAutotagWarning, id) return err } const countLibraries = `-- name: CountLibraries :one SELECT COUNT(*) AS count FROM libraries ` func (q *Queries) CountLibraries(ctx context.Context) (int64, error) { row := q.db.QueryRowContext(ctx, countLibraries) var count int64 err := row.Scan(&count) return count, err } const createLibrary = `-- name: CreateLibrary :one INSERT INTO libraries (name, path) VALUES (?, ?) RETURNING id, name, path, created_at, autotag_warning_acked ` type CreateLibraryParams struct { Name string Path string } func (q *Queries) CreateLibrary(ctx context.Context, arg CreateLibraryParams) (Library, error) { row := q.db.QueryRowContext(ctx, createLibrary, arg.Name, arg.Path) var i Library err := row.Scan( &i.ID, &i.Name, &i.Path, &i.CreatedAt, &i.AutotagWarningAcked, ) return i, err } const deleteLibrary = `-- name: DeleteLibrary :exec DELETE FROM libraries WHERE id = ? ` func (q *Queries) DeleteLibrary(ctx context.Context, id int64) error { _, err := q.db.ExecContext(ctx, deleteLibrary, id) return err } const getAllLibraries = `-- name: GetAllLibraries :many SELECT id, name, path, created_at, autotag_warning_acked FROM libraries ORDER BY name ` func (q *Queries) GetAllLibraries(ctx context.Context) ([]Library, error) { rows, err := q.db.QueryContext(ctx, getAllLibraries) if err != nil { return nil, err } defer rows.Close() var items []Library for rows.Next() { var i Library if err := rows.Scan( &i.ID, &i.Name, &i.Path, &i.CreatedAt, &i.AutotagWarningAcked, ); 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 getLibrary = `-- name: GetLibrary :one SELECT id, name, path, created_at, autotag_warning_acked FROM libraries WHERE id = ? LIMIT 1 ` func (q *Queries) GetLibrary(ctx context.Context, id int64) (Library, error) { row := q.db.QueryRowContext(ctx, getLibrary, id) var i Library err := row.Scan( &i.ID, &i.Name, &i.Path, &i.CreatedAt, &i.AutotagWarningAcked, ) return i, err } const getLibraryByPath = `-- name: GetLibraryByPath :one SELECT id, name, path, created_at, autotag_warning_acked FROM libraries WHERE path = ? LIMIT 1 ` func (q *Queries) GetLibraryByPath(ctx context.Context, path string) (Library, error) { row := q.db.QueryRowContext(ctx, getLibraryByPath, path) var i Library err := row.Scan( &i.ID, &i.Name, &i.Path, &i.CreatedAt, &i.AutotagWarningAcked, ) return i, err } const updateLibraryName = `-- name: UpdateLibraryName :exec UPDATE libraries SET name = ? WHERE id = ? ` type UpdateLibraryNameParams struct { Name string ID int64 } func (q *Queries) UpdateLibraryName(ctx context.Context, arg UpdateLibraryNameParams) error { _, err := q.db.ExecContext(ctx, updateLibraryName, arg.Name, arg.ID) return err }