Documentation
¶
Index ¶
- Variables
- type BookRepo
- type BookRepoImpl
- func (r *BookRepoImpl) Create(ctx context.Context, ent *postgresdb.Book) (int64, error)
- func (r *BookRepoImpl) Delete(ctx context.Context, opt dbkit.DeleteOption) (int64, error)
- func (r *BookRepoImpl) Find(ctx context.Context, opts ...dbkit.SelectOption) (list []*postgresdb.Book, err error)
- func (r *BookRepoImpl) Patch(ctx context.Context, ent *postgresdb.Book, opt dbkit.UpdateOption) (int64, error)
- func (r *BookRepoImpl) Update(ctx context.Context, ent *postgresdb.Book, opt dbkit.UpdateOption) (int64, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // BookTableName is table name for books entity BookTableName = "books" // BookTable is columns for books entity BookTable = struct { ID string Title string Author string UpdatedAt string CreatedAt string }{ ID: "id", Title: "title", Author: "author", UpdatedAt: "updated_at", CreatedAt: "created_at", } )
Functions ¶
This section is empty.
Types ¶
type BookRepo ¶
type BookRepo interface {
Find(context.Context, ...dbkit.SelectOption) ([]*postgresdb.Book, error)
Create(context.Context, *postgresdb.Book) (int64, error)
Delete(context.Context, dbkit.DeleteOption) (int64, error)
Update(context.Context, *postgresdb.Book, dbkit.UpdateOption) (int64, error)
Patch(context.Context, *postgresdb.Book, dbkit.UpdateOption) (int64, error)
}
BookRepo to get books data from database @mock
func NewBookRepo ¶
func NewBookRepo(impl BookRepoImpl) BookRepo
NewBookRepo return new instance of BookRepo
type BookRepoImpl ¶
BookRepoImpl is implementation books repository
func (*BookRepoImpl) Create ¶
func (r *BookRepoImpl) Create(ctx context.Context, ent *postgresdb.Book) (int64, error)
Create books
func (*BookRepoImpl) Delete ¶
func (r *BookRepoImpl) Delete(ctx context.Context, opt dbkit.DeleteOption) (int64, error)
Delete books
func (*BookRepoImpl) Find ¶
func (r *BookRepoImpl) Find(ctx context.Context, opts ...dbkit.SelectOption) (list []*postgresdb.Book, err error)
Find books
func (*BookRepoImpl) Patch ¶
func (r *BookRepoImpl) Patch(ctx context.Context, ent *postgresdb.Book, opt dbkit.UpdateOption) (int64, error)
Patch books
func (*BookRepoImpl) Update ¶
func (r *BookRepoImpl) Update(ctx context.Context, ent *postgresdb.Book, opt dbkit.UpdateOption) (int64, error)
Update books
Click to show internal directories.
Click to hide internal directories.