Documentation
¶
Index ¶
- Constants
- func FilterDeleted() func(db *gorm.DB) *gorm.DB
- func NewKidLogger(config *gLogger.Config) gLogger.Interface
- func Paginate(pageNum, pageSize int) func(db *gorm.DB) *gorm.DB
- func Search(wheres []*WhereWrapper) func(db *gorm.DB) *gorm.DB
- func SearchScope(wheres repository.Wheres) func(db *gorm.DB) *gorm.DB
- func Where(wheres []*WhereWrapper) func(db *gorm.DB) *gorm.DB
- func Wheres(wheres repository.Wheres) func(db *gorm.DB) *gorm.DB
- type AutoMigrate
- type KidLogger
- func (log *KidLogger) Error(ctx context.Context, msg string, data ...interface{})
- func (log *KidLogger) Info(ctx context.Context, msg string, data ...interface{})
- func (log *KidLogger) LogMode(level gLogger.LogLevel) gLogger.Interface
- func (log *KidLogger) Trace(ctx context.Context, begin time.Time, ...)
- func (log *KidLogger) Warn(ctx context.Context, msg string, data ...interface{})
- type MySQL
- type Option
- func WithDb(dbName string) Option
- func WithHost(host string) Option
- func WithLogLevel(logLevel int) Option
- func WithMaxIdle(maxIdle int) Option
- func WithMaxLife(maxLife time.Duration) Option
- func WithMaxOpen(maxOpen int) Option
- func WithPassword(password string) Option
- func WithPort(port int) Option
- func WithUser(user string) Option
- type Options
- type Repository
- func (repo *Repository) Create(val interface{}) error
- func (repo *Repository) CreateInTx(ctx context.Context, val interface{}) error
- func (repo *Repository) Delete(delete *repository.Delete) error
- func (repo *Repository) DeleteInTx(ctx context.Context, delete *repository.Delete) error
- func (repo *Repository) Find(query *repository.Query) error
- func (repo *Repository) Get(query *repository.Query) error
- func (repo *Repository) GetTx(ctx context.Context) (interface{}, error)
- func (repo *Repository) Provide(context.Context) interface{}
- func (repo *Repository) Tx(ctx context.Context, txFunc func(context.Context) error) error
- func (repo *Repository) Update(update *repository.Update) error
- func (repo *Repository) UpdateColumn(update *repository.Update) error
- func (repo *Repository) UpdateColumnInTx(ctx context.Context, update *repository.Update) error
- func (repo *Repository) UpdateInTx(ctx context.Context, update *repository.Update) error
- type WhereWrapper
Constants ¶
View Source
const ( ConditionTypeLte = "<=" ConditionTypeLt = "<" ConditionTypeGte = ">=" ConditionTypeGt = ">" ConditionTypeEq = "=" ConditionTypeIn = "in" )
Variables ¶
This section is empty.
Functions ¶
func SearchScope ¶
Types ¶
type AutoMigrate ¶
type AutoMigrate interface {
Models() []interface{}
}
type Option ¶
type Option func(*Options)
func WithLogLevel ¶
func WithMaxIdle ¶
func WithMaxLife ¶
func WithMaxOpen ¶
func WithPassword ¶
type Repository ¶
type Repository struct {
DB *MySQL `inject:""`
}
func (*Repository) Create ¶
func (repo *Repository) Create(val interface{}) error
func (*Repository) CreateInTx ¶ added in v1.9.1
func (repo *Repository) CreateInTx(ctx context.Context, val interface{}) error
func (*Repository) Delete ¶
func (repo *Repository) Delete(delete *repository.Delete) error
func (*Repository) DeleteInTx ¶ added in v1.9.1
func (repo *Repository) DeleteInTx(ctx context.Context, delete *repository.Delete) error
func (*Repository) Find ¶
func (repo *Repository) Find(query *repository.Query) error
func (*Repository) Get ¶ added in v1.9.1
func (repo *Repository) Get(query *repository.Query) error
func (*Repository) GetTx ¶ added in v1.9.1
func (repo *Repository) GetTx(ctx context.Context) (interface{}, error)
func (*Repository) Provide ¶
func (repo *Repository) Provide(context.Context) interface{}
func (*Repository) Update ¶
func (repo *Repository) Update(update *repository.Update) error
func (*Repository) UpdateColumn ¶ added in v1.9.1
func (repo *Repository) UpdateColumn(update *repository.Update) error
func (*Repository) UpdateColumnInTx ¶ added in v1.9.1
func (repo *Repository) UpdateColumnInTx(ctx context.Context, update *repository.Update) error
func (*Repository) UpdateInTx ¶ added in v1.9.1
func (repo *Repository) UpdateInTx(ctx context.Context, update *repository.Update) error
type WhereWrapper ¶
func NewWhereWrapper ¶
func NewWhereWrapper(col string, condition string, val interface{}) *WhereWrapper
func Wrappers ¶
func Wrappers(conditions ...*WhereWrapper) []*WhereWrapper
Click to show internal directories.
Click to hide internal directories.