Documentation
¶
Index ¶
- type Book
- type BookRepo
- type BookRepoImpl
- func (r *BookRepoImpl) Create(ctx context.Context, book *Book) (*Book, error)
- func (r *BookRepoImpl) Delete(ctx context.Context, id int64) (err error)
- func (r *BookRepoImpl) Find(ctx context.Context, opts ...dbkit.FindOption) (list []*Book, err error)
- func (r *BookRepoImpl) FindOne(ctx context.Context, id int64) (*Book, error)
- func (r *BookRepoImpl) Update(ctx context.Context, id int64, forms *Book) (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:"update_at"`
CreatedAt time.Time `json:"created_at"`
}
Book represented database model
type BookRepo ¶
type BookRepo interface {
FindOne(context.Context, int64) (*Book, error)
Find(context.Context, ...dbkit.FindOption) ([]*Book, error)
Create(context.Context, *Book) (*Book, error)
Delete(context.Context, int64) error
Update(context.Context, int64, *Book) (*Book, error)
}
BookRepo to get book data from database @mock
func NewBookRepo ¶
func NewBookRepo(impl BookRepoImpl) BookRepo
NewBookRepo return new instance of BookRepo @constructor
type BookRepoImpl ¶
BookRepoImpl is implementation book repository
func (*BookRepoImpl) Delete ¶
func (r *BookRepoImpl) Delete(ctx context.Context, id int64) (err error)
Delete book
func (*BookRepoImpl) Find ¶
func (r *BookRepoImpl) Find(ctx context.Context, opts ...dbkit.FindOption) (list []*Book, err error)
Find book
Click to show internal directories.
Click to hide internal directories.