repository

package
v0.0.0-...-1473d8a Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: GPL-3.0 Imports: 3 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   int32  `json:"id"`
	Name string `json:"name"`
}

type Book

type Book struct {
	ID       int32  `json:"id"`
	Title    string `json:"title"`
	AuthorID int32  `json:"author_id"`
}

type CreateBookParams

type CreateBookParams struct {
	Title    string `json:"title"`
	AuthorID int32  `json:"author_id"`
}

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 Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateBook

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

func (*Queries) DeleteBook

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

func (*Queries) ReadBook

func (q *Queries) ReadBook(ctx context.Context, id int32) (Book, error)

func (*Queries) ReadBooks

func (q *Queries) ReadBooks(ctx context.Context) ([]Book, error)

func (*Queries) UpdateBook

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

func (*Queries) WithTx

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

type UpdateBookParams

type UpdateBookParams struct {
	Title    string `json:"title"`
	AuthorID int32  `json:"author_id"`
	ID       int32  `json:"id"`
}

Jump to

Keyboard shortcuts

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