Documentation ¶
Overview ¶
controllers/base_controller.go
models/IModel.go
app/ISchema.go
service/IService.go
Index ¶
- type BaseController
- func (bc *BaseController[T, CreateDTO, QueryDTO, TVO]) BulkCreate(c igin.IContext)
- func (bc *BaseController[T, CreateDTO, QueryDTO, TVO]) BulkDelete(c igin.IContext)
- func (bc *BaseController[T, CreateDTO, QueryDTO, TVO]) Create(c igin.IContext)
- func (bc *BaseController[T, CreateDTO, QueryDTO, TVO]) GetById(c igin.IContext)
- func (bc *BaseController[T, CreateDTO, QueryDTO, TVO]) GetTreeById(c igin.IContext)
- func (bc *BaseController[IModel, CreateDTO, QueryDTO, TVO]) PageByDTO(c igin.IContext)
- func (bc *BaseController[T, CreateDTO, QueryDTO, TVO]) UpdateByMap(c igin.IContext)
- type BaseDTO
- type BaseService
- func (bs *BaseService[T]) BulkCreate(models []T) (int, []T, error)
- func (bs *BaseService[T]) BulkDelete(ids []string) (int, error)
- func (bs *BaseService[T]) Create(model *T) (*T, error)
- func (bs *BaseService[T]) Delete(id string) error
- func (bs *BaseService[T]) GetById(id string) (*T, error)
- func (bs *BaseService[T]) GetTreeById(id string) ([]T, error)
- func (bs *BaseService[T]) PageByMap(queryMap map[string]interface{}, queryPage *QueryPage) (*[]T, int, error)
- func (bs *BaseService[T]) Update(id string, model T) (*T, error)
- func (bs *BaseService[T]) UpdateByMap(id string, dtoMap map[string]interface{}) error
- type BaseVO
- type GenericModel
- type IBaseController
- type IBaseService
- type ICreateDTO
- type IModel
- type IQueryDTO
- type ISO8601Time
- type IVO
- type IdTimeStampsModel
- type MixinModel
- type OperatorModel
- type QueryPage
- type SnowflakeIDModel
- type SoftDeleteModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseController ¶
type BaseController[T IModel, CreateDTO ICreateDTO, QueryDTO IQueryDTO, TVO IVO] struct { Service IBaseService[T] }
func NewBaseController ¶
func NewBaseController[T IModel, CreateDTO ICreateDTO, QueryDTO IQueryDTO, TVO IVO](s IBaseService[T]) *BaseController[T, CreateDTO, QueryDTO, TVO]
func (*BaseController[T, CreateDTO, QueryDTO, TVO]) BulkCreate ¶
func (bc *BaseController[T, CreateDTO, QueryDTO, TVO]) BulkCreate(c igin.IContext)
func (*BaseController[T, CreateDTO, QueryDTO, TVO]) BulkDelete ¶
func (bc *BaseController[T, CreateDTO, QueryDTO, TVO]) BulkDelete(c igin.IContext)
func (*BaseController[T, CreateDTO, QueryDTO, TVO]) Create ¶
func (bc *BaseController[T, CreateDTO, QueryDTO, TVO]) Create(c igin.IContext)
func (*BaseController[T, CreateDTO, QueryDTO, TVO]) GetById ¶
func (bc *BaseController[T, CreateDTO, QueryDTO, TVO]) GetById(c igin.IContext)
func (*BaseController[T, CreateDTO, QueryDTO, TVO]) GetTreeById ¶
func (bc *BaseController[T, CreateDTO, QueryDTO, TVO]) GetTreeById(c igin.IContext)
func (*BaseController[IModel, CreateDTO, QueryDTO, TVO]) PageByDTO ¶
func (bc *BaseController[IModel, CreateDTO, QueryDTO, TVO]) PageByDTO(c igin.IContext)
func (*BaseController[T, CreateDTO, QueryDTO, TVO]) UpdateByMap ¶
func (bc *BaseController[T, CreateDTO, QueryDTO, TVO]) UpdateByMap(c igin.IContext)
type BaseService ¶
func NewBaseService ¶
func NewBaseService[T IModel](db *gorm.DB, model T) *BaseService[T]
func (*BaseService[T]) BulkCreate ¶
func (bs *BaseService[T]) BulkCreate(models []T) (int, []T, error)
func (*BaseService[T]) BulkDelete ¶
func (bs *BaseService[T]) BulkDelete(ids []string) (int, error)
func (*BaseService[T]) Create ¶
func (bs *BaseService[T]) Create(model *T) (*T, error)
func (*BaseService[T]) Delete ¶
func (bs *BaseService[T]) Delete(id string) error
func (*BaseService[T]) GetById ¶
func (bs *BaseService[T]) GetById(id string) (*T, error)
func (*BaseService[T]) GetTreeById ¶
func (bs *BaseService[T]) GetTreeById(id string) ([]T, error)
根据 [Id] 查询记录返回 [树形切片]
func (*BaseService[T]) PageByMap ¶
func (bs *BaseService[T]) PageByMap(queryMap map[string]interface{}, queryPage *QueryPage) (*[]T, int, error)
func (*BaseService[T]) Update ¶
func (bs *BaseService[T]) Update(id string, model T) (*T, error)
func (*BaseService[T]) UpdateByMap ¶
func (bs *BaseService[T]) UpdateByMap(id string, dtoMap map[string]interface{}) error
type BaseVO ¶
type BaseVO struct{}
func (BaseVO) GetDetailVO ¶
func (BV BaseVO) GetDetailVO() interface{}
type GenericModel ¶
type IBaseController ¶
type IBaseService ¶
type IBaseService[T IModel] interface { Create(model *T) (*T, error) BulkCreate(models []T) (int, []T, error) GetById(id string) (*T, error) Update(id string, model T) (*T, error) Delete(id string) error BulkDelete(ids []string) (int, error) PageByMap(queryDto map[string]any, queryPage *QueryPage) (*[]T, int, error) GetTreeById(id string) ([]T, error) UpdateByMap(id string, dtoMap map[string]interface{}) error }
type ICreateDTO ¶
type ICreateDTO interface { }
type ISO8601Time ¶
ISO8601Time 自定义时间类型
func NewISO8601Time ¶
func NewISO8601Time(t time.Time, format string) ISO8601Time
NewISO8601Time 创建新的 ISO8601Time 实例
func (ISO8601Time) MarshalJSON ¶
func (t ISO8601Time) MarshalJSON() ([]byte, error)
MarshalJSON 实现自定义的 JSON 序列化方法
func (*ISO8601Time) UnmarshalJSON ¶
func (t *ISO8601Time) UnmarshalJSON(data []byte) error
UnmarshalJSON 实现自定义的 JSON 解析方法
type IdTimeStampsModel ¶
type IdTimeStampsModel struct { Id int64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"Id,string"` CreatedAt ISO8601Time `gorm:"column:created_at"` UpdatedAt ISO8601Time `gorm:"column:updated_at"` }
func (*IdTimeStampsModel) BeforeCreate ¶
func (m *IdTimeStampsModel) BeforeCreate(tx *gorm.DB) error
BeforeCreate 钩子方法在记录创建前调用
func (*IdTimeStampsModel) BeforeUpdate ¶
func (m *IdTimeStampsModel) BeforeUpdate(tx *gorm.DB) error
BeforeUpdate 钩子方法在记录更新前调用
type MixinModel ¶
type MixinModel struct { OperatorModel IdTimeStampsModel GenericModel }
type OperatorModel ¶
type QueryPage ¶
type SnowflakeIDModel ¶
type SnowflakeIDModel struct {
Id int64 `gorm:"column:id;primaryKey;autoIncrement:true" json:"Id,string"`
}
SnowflakeIDModel 是基于雪花算法生成唯一标识的基础模型
func (*SnowflakeIDModel) BeforeCreate ¶
func (m *SnowflakeIDModel) BeforeCreate(tx *gorm.DB) error
BeforeCreate 在创建记录前为模型生成雪花算法ID
type SoftDeleteModel ¶
Click to show internal directories.
Click to hide internal directories.