dbgen

package
v0.0.0-...-e34d481 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 4 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   pgtype.UUID
	Name string
	Bio  string
}

type Book

type Book struct {
	ID          pgtype.UUID
	Title       string
	Isbn        string
	PublishedAt pgtype.Date
	PriceCents  int64
	AuthorID    pgtype.UUID
	GenreID     pgtype.UUID
}

type DBTX

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

type Genre

type Genre struct {
	ID   pgtype.UUID
	Name string
	Slug string
}

type GetBookByIDRow

type GetBookByIDRow struct {
	ID          pgtype.UUID
	Title       string
	Isbn        string
	PublishedAt pgtype.Date
	PriceCents  int64
	AuthorID    pgtype.UUID
	AuthorName  string
	AuthorBio   string
	GenreID     pgtype.UUID
	GenreName   string
	GenreSlug   string
}

type ListBooksParams

type ListBooksParams struct {
	Limit  int32
	Offset int32
	Query  pgtype.Text
	Genre  pgtype.Text
}

type ListBooksRow

type ListBooksRow struct {
	ID          pgtype.UUID
	Title       string
	Isbn        string
	PublishedAt pgtype.Date
	PriceCents  int64
	AuthorID    pgtype.UUID
	AuthorName  string
	AuthorBio   string
	GenreID     pgtype.UUID
	GenreName   string
	GenreSlug   string
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) GetBookByID

func (q *Queries) GetBookByID(ctx context.Context, id pgtype.UUID) (GetBookByIDRow, error)

func (*Queries) ListBooks

func (q *Queries) ListBooks(ctx context.Context, arg ListBooksParams) ([]ListBooksRow, error)

func (*Queries) WithTx

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

Jump to

Keyboard shortcuts

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