Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoAffect = errors.New("No rows affected") ErrNoBookFound = errors.New("No book found") )
View Source
var ( ErrInvalidID = errors.New("ID is not in the correct form") ErrInvalidSort = errors.New("invalid sort field") )
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type Repository interface { GetAll() ([]Book, error) GetById(id string) (*Book, error) Search(sp SearchParams, sortOrder string, limit, offset int) ([]Book, error) Create(bk *Book) error Update(bk *Book) error Destroy(id string) error }
func NewRepository ¶
func NewRepository(db *sql.DB) Repository
type SearchParams ¶
type Service ¶
type Service interface { GetAll() ([]Book, error) GetById(id string) (*Book, error) Search(sp SearchParams, sort, order, limitStr, offsetStr string) ([]Book, error) Create(nb *NewBook) (*Book, error) Update(id string, ub UpdateBook) error Destroy(id string) error }
func NewService ¶
func NewService(br Repository) Service
Click to show internal directories.
Click to hide internal directories.