db

package
v0.0.0-...-0e3b5e0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	ID    string
	Name  string
	Genre string
	Bio   string
}

type Book

type Book struct {
	ID       string
	Title    string
	Isbn     string
	Year     int64
	AuthorID string
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) DeleteAuthor

func (q *Queries) DeleteAuthor(ctx context.Context, id string) error

func (*Queries) DeleteBook

func (q *Queries) DeleteBook(ctx context.Context, id string) error

func (*Queries) GetAuthor

func (q *Queries) GetAuthor(ctx context.Context, id string) (Author, error)

func (*Queries) GetBook

func (q *Queries) GetBook(ctx context.Context, id string) (Book, error)

func (*Queries) ListAuthors

func (q *Queries) ListAuthors(ctx context.Context) ([]Author, error)

func (*Queries) ListBooksByAuthor

func (q *Queries) ListBooksByAuthor(ctx context.Context, authorID string) ([]Book, error)

func (*Queries) SearchAuthors

func (q *Queries) SearchAuthors(ctx context.Context, genre string) ([]Author, error)

func (*Queries) UpsertAuthor

func (q *Queries) UpsertAuthor(ctx context.Context, arg UpsertAuthorParams) error

func (*Queries) UpsertBook

func (q *Queries) UpsertBook(ctx context.Context, arg UpsertBookParams) error

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type UpsertAuthorParams

type UpsertAuthorParams struct {
	ID    string
	Name  string
	Genre string
	Bio   string
}

type UpsertBookParams

type UpsertBookParams struct {
	ID       string
	Title    string
	Isbn     string
	Year     int64
	AuthorID string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL