db

package
v0.0.0-...-7428172 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: MIT Imports: 8 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              int            `db:"id"`
	Isbn            string         `db:"isbn"`
	Title           string         `db:"title"`
	Author          sql.NullString `db:"author"`
	PublicationYear sql.NullString `db:"publication_year"`
	Publisher       sql.NullString `db:"publisher"`
	CreatedAt       time.Time      `db:"created_at"`
	UpdatedAt       sql.NullTime   `db:"updated_at"`
}

type Store

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

func NewStore

func NewStore(db *sqlx.DB, logger *zap.SugaredLogger) Store

func (Store) Create

func (s Store) Create(ctx context.Context, book Book) (id int, err error)

func (Store) Query

func (s Store) Query(ctx context.Context, page int, rowsPerPage int) ([]Book, error)

func (Store) QueryByID

func (s Store) QueryByID(ctx context.Context, id int) (Book, error)

Jump to

Keyboard shortcuts

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