Documentation
¶
Index ¶
- func Logger(logger *log.Logger) gin.HandlerFunc
- func NewStore(name, dsn, prefix string, keyPairs ...[]byte) (store ginsession.Store, err error)
- func NewStoreWithIMDB(db imdb.Conn, prefix string, keyPairs ...[]byte) ginsession.Store
- func OpenDB(name, dsn string, config interface{}) (*gorm.DB, error)
- func Recover(logger *log.Logger) gin.HandlerFunc
- func RegisterErrorCode(codes map[int]int)
- func Trace(callee string) gin.HandlerFunc
- type Adminer
- type Controller
- type CountModel
- type Creator
- type Dao
- func (d Dao) Count(ctx context.Context, equal Equal) (count int64, err error)
- func (d Dao) Create(ctx context.Context, equal Equal, value interface{}) (err error)
- func (d Dao) DB(ctx context.Context) *gorm.DB
- func (d Dao) Delete(ctx context.Context, equal Equal, update Update) (err error)
- func (d Dao) Equal(ctx context.Context, equal Equal) *gorm.DB
- func (d Dao) Find(ctx context.Context, equal Equal, out interface{}) (err error)
- func (d Dao) First(ctx context.Context, equal Equal, out interface{}) (err error)
- func (d Dao) List(ctx context.Context, query Query, equal Equal, out interface{}) (total int64, err error)
- func (d Dao) QueryDeleted(ok bool) Dao
- func (d Dao) Update(ctx context.Context, equal Equal, update Update) (err error)
- type Deleter
- type Equal
- type Getter
- type Lister
- type Model
- type ModelBase
- type ModelExtra
- type Modeler
- type Query
- func (q *Query) ByCustom(db *gorm.DB) *gorm.DB
- func (q *Query) ByLimit(db *gorm.DB) *gorm.DB
- func (q *Query) ByQuery(db *gorm.DB) *gorm.DB
- func (q *Query) BySelect(db *gorm.DB) *gorm.DB
- func (q *Query) BySort(db *gorm.DB) *gorm.DB
- func (q *Query) ByWhere(db *gorm.DB) *gorm.DB
- func (q *Query) Valid(ctx *gin.Context) (err error)
- type Response
- type Result
- type Result2
- type Service
- func (s *Service[User, Model]) Create(ctx context.Context, create Creator) (m *Model, err error)
- func (s *Service[User, Model]) Delete(ctx context.Context, delete Deleter) (err error)
- func (s *Service[User, Model]) Get(ctx context.Context, get Getter) (m *Model, err error)
- func (s *Service[User, Model]) List(ctx context.Context, list Lister) (result *Result2[Model], err error)
- func (s *Service[User, Model]) Update(ctx context.Context, update Updater) (err error)
- type Sessioner
- type Update
- type Updater
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStore ¶
func NewStore(name, dsn, prefix string, keyPairs ...[]byte) (store ginsession.Store, err error)
func NewStoreWithIMDB ¶
func Trace ¶
func Trace(callee string) gin.HandlerFunc
Types ¶
type CountModel ¶
type CountModel struct {
CountByYear int16 `json:"count_by_year" gorm:"index"` // 按年统计
CountByMonth int16 `json:"count_by_month" gorm:"index"` // 按月统计
CountByWeek int16 `json:"count_by_week" gorm:"index"` // 按周统计
CountByDay int16 `json:"count_by_day" gorm:"index"` // 按天统计
CountByHour int16 `json:"count_by_hour" gorm:"index"` // 按时统计
}
type Dao ¶
type Dao struct {
// contains filtered or unexported fields
}
func (Dao) QueryDeleted ¶
type Model ¶
type Model struct {
ModelBase
ModelExtra
}
type ModelExtra ¶ added in v1.0.74
type ModelExtra struct {
CreatedAt int64 `json:"created_at" gorm:"index"`
UpdatedAt int64 `json:"updated_at" gorm:"index"`
DeletedAt int64 `json:"deleted_at" gorm:"index"`
CreatedID string `json:"created_id" gorm:"index"`
UpdatedID string `json:"updated_id" gorm:"index"`
DeletedID string `json:"deleted_id" gorm:"index"`
CreatedBy string `json:"created_by" gorm:"index"`
UpdatedBy string `json:"updated_by" gorm:"index"`
DeletedBy string `json:"deleted_by" gorm:"index"`
}
func (*ModelExtra) SetModelExtra ¶ added in v1.0.75
func (m *ModelExtra) SetModelExtra(extra ModelExtra)
type Modeler ¶ added in v1.0.75
type Modeler interface {
SetModelExtra(extra ModelExtra)
}
type Query ¶
type Query struct {
Page int `form:"page" json:"page,omitempty"` // 当前页
Size int `form:"size" json:"size,omitempty"` // 页大小
Sort string `form:"sort" json:"sort,omitempty"` // 排序
Cond string `form:"cond" json:"cond,omitempty"` // 条件符号:and、or,用于自定义字段查询
Omit []string `form:"omit" json:"omit,omitempty"` // 忽略字段
Select []string `form:"select" json:"select,omitempty"` // 选择字段
Where string `form:"where" json:"where,omitempty"` // 自定义条件SQL
// contains filtered or unexported fields
}
type Response ¶
type Service ¶ added in v1.0.75
func NewService ¶ added in v1.0.76
Click to show internal directories.
Click to hide internal directories.