Help us shape the future of Go! Take the 2026 Go Developer Survey

booktest

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 6 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 {
	AuthorID int32
	Name     string
}

type Book

type Book struct {
	BookID    int32
	AuthorID  int32
	Isbn      string
	BookType  BookType
	Title     string
	Year      int32
	Available pgtype.Timestamptz
	Tags      []string
}

type BookType

type BookType string
const (
	BookTypeFICTION    BookType = "FICTION"
	BookTypeNONFICTION BookType = "NONFICTION"
)

func (*BookType) Scan

func (e *BookType) Scan(src any) error

type BooksByTagsRow

type BooksByTagsRow struct {
	BookID int32
	Title  string
	Name   pgtype.Text
	Isbn   string
	Tags   []string
}

type BooksByTitleYearParams

type BooksByTitleYearParams struct {
	Title string
	Year  int32
}

type CreateBookParams

type CreateBookParams struct {
	AuthorID  int32
	Isbn      string
	BookType  BookType
	Title     string
	Year      int32
	Available pgtype.Timestamptz
	Tags      []string
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...any) (pgconn.CommandTag, error)
	Query(context.Context, string, ...any) (pgx.Rows, error)
	QueryRow(context.Context, string, ...any) pgx.Row
}

type NullBookType

type NullBookType struct {
	BookType BookType
	Valid    bool // Valid is true if BookType is not NULL
}

func (*NullBookType) Scan

func (ns *NullBookType) Scan(value any) error

Scan implements the Scanner interface.

func (NullBookType) Value

func (ns NullBookType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) BooksByTags

func (q *Queries) BooksByTags(ctx context.Context, dollar_1 []string) ([]BooksByTagsRow, error)

func (*Queries) BooksByTitleYear

func (q *Queries) BooksByTitleYear(ctx context.Context, arg BooksByTitleYearParams) ([]Book, error)

func (*Queries) CreateAuthor

func (q *Queries) CreateAuthor(ctx context.Context, name string) (Author, error)

func (*Queries) CreateBook

func (q *Queries) CreateBook(ctx context.Context, arg CreateBookParams) (Book, error)

func (*Queries) DeleteBook

func (q *Queries) DeleteBook(ctx context.Context, bookID int32) error

func (*Queries) GetAuthor

func (q *Queries) GetAuthor(ctx context.Context, authorID int32) (Author, error)

func (*Queries) GetBook

func (q *Queries) GetBook(ctx context.Context, bookID int32) (Book, error)

func (*Queries) SayHello

func (q *Queries) SayHello(ctx context.Context, s string) (pgtype.Text, error)

func (*Queries) UpdateBook

func (q *Queries) UpdateBook(ctx context.Context, arg UpdateBookParams) error

func (*Queries) UpdateBookISBN

func (q *Queries) UpdateBookISBN(ctx context.Context, arg UpdateBookISBNParams) error

func (*Queries) WithTx

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

type UpdateBookISBNParams

type UpdateBookISBNParams struct {
	Title  string
	Tags   []string
	BookID int32
	Isbn   string
}

type UpdateBookParams

type UpdateBookParams struct {
	Title  string
	Tags   []string
	BookID int32
}

Jump to

Keyboard shortcuts

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