Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository( logger *log.Logger, db *gorm.DB, ) *Repository
func (*Repository) DB ¶
func (r *Repository) DB(ctx context.Context) *dao.Query
DB return tx If you need to create a Transaction, you must call DB(ctx) and Transaction(ctx,fn)
func (*Repository) Transaction ¶
type Transaction ¶
type Transaction interface {
Transaction(ctx context.Context, fn func(ctx context.Context) error) error
}
func NewTransaction ¶
func NewTransaction(r *Repository) Transaction
type UserRepository ¶
type UserRepository interface {
Create(ctx context.Context, user *model.User) error
Update(ctx context.Context, user *model.User) error
Delete(ctx context.Context, id int64) error
FindOne(ctx context.Context, id int64) (*model.User, error)
FindOneByOther(ctx context.Context, do *model.User) (*model.User, error)
All(ctx context.Context, do *model.User) ([]*model.User, error)
List(ctx context.Context, page, size int, do *model.User) ([]*model.User, error)
Count(ctx context.Context, do *model.User) (int64, error)
}
func NewUserRepository ¶
func NewUserRepository( r *Repository, ) UserRepository
Click to show internal directories.
Click to hide internal directories.