authors

package
v0.0.0-...-05e3125 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Unlicense Imports: 5 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
	Description pgtype.Text
}

type Book

type Book struct {
	ID          string
	Name        string
	Description pgtype.Text
	AuthorID    string
	Rating      float64
	PublishedAt time.Time
}

type CreateParams

type CreateParams struct {
	Name        string
	Description pgtype.Text
}

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 GetAllRow

type GetAllRow struct {
	ID            string
	Name          string
	Description   pgtype.Text
	AverageRating float64
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) Create

func (q *Queries) Create(ctx context.Context, arg CreateParams) (string, error)

func (*Queries) Get

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

func (*Queries) GetAll

func (q *Queries) GetAll(ctx context.Context) ([]GetAllRow, 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