Documentation
¶
Index ¶
- type Book
- type BookRepository
- type BookRepositoryImpl
- func (r *BookRepositoryImpl) Delete(ctx context.Context, id int64) (err error)
- func (r *BookRepositoryImpl) Find(ctx context.Context, id int64) (book *Book, err error)
- func (r *BookRepositoryImpl) Insert(ctx context.Context, book Book) (lastInsertID int64, err error)
- func (r *BookRepositoryImpl) List(ctx context.Context) (list []*Book, err error)
- func (r *BookRepositoryImpl) Update(ctx context.Context, book Book) (err error)
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" validate:"required"`
Author string `json:"author" validate:"required"`
UpdatedAt time.Time `json:"-"`
CreatedAt time.Time `json:"-"`
}
Book represented database model
type BookRepository ¶
type BookRepository interface {
Find(ctx context.Context, id int64) (*Book, error)
List(ctx context.Context) ([]*Book, error)
Insert(ctx context.Context, book Book) (lastInsertID int64, err error)
Delete(ctx context.Context, id int64) error
Update(ctx context.Context, book Book) error
}
BookRepository to get book data from databasesa
func NewBookRepository ¶
func NewBookRepository(impl BookRepositoryImpl) BookRepository
NewBookRepository return new instance of BookRepository
type BookRepositoryImpl ¶ added in v0.6.4
BookRepositoryImpl is implementation book repository
func (*BookRepositoryImpl) Delete ¶ added in v0.6.4
func (r *BookRepositoryImpl) Delete(ctx context.Context, id int64) (err error)
Delete book
Click to show internal directories.
Click to hide internal directories.