models

package
v0.0.0-...-a67acf8 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 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 Book

type Book struct {
	ID        int64  `json:"id"`
	Title     string `json:"title"`
	Author    string `json:"author"`
	Publisher string `json:"publisher"`
}

type CreateBookParams

type CreateBookParams struct {
	Title     string `json:"title"`
	Author    string `json:"author"`
	Publisher string `json:"publisher"`
}

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) CreateBook

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

func (*Queries) DeleteBook

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

func (*Queries) GetBook

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

func (*Queries) GetBooks

func (q *Queries) GetBooks(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 *sql.Tx) *Queries

type UpdateBookParams

type UpdateBookParams struct {
	Title     string `json:"title"`
	Author    string `json:"author"`
	Publisher string `json:"publisher"`
	ID        int64  `json:"id"`
}

Jump to

Keyboard shortcuts

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