Documentation ¶
Index ¶
- type BaseDao
- type BaseDaoImpl
- func (dao BaseDaoImpl[T]) Create(obj *T) (err error)
- func (dao BaseDaoImpl[T]) Delete(objs ...T) (err error)
- func (dao BaseDaoImpl[T]) DeleteBy(filedName string, value ...string) (err error)
- func (dao BaseDaoImpl[T]) DeleteByIDs(ids ...string) (err error)
- func (dao BaseDaoImpl[T]) GetAll() (objs []T, err error)
- func (dao BaseDaoImpl[T]) GetBy(filedName string, value ...any) (objs []T, err error)
- func (dao BaseDaoImpl[T]) GetByID(id string) (obj T, err error)
- func (dao BaseDaoImpl[T]) GetByIDs(ids ...string) (objs []T, err error)
- func (dao BaseDaoImpl[T]) GetOne(filedName string, value any) (obj T, err error)
- func (dao BaseDaoImpl[T]) GetPage(pagination Pagination) (PagingResult[T], error)
- func (dao BaseDaoImpl[T]) GetPageBy(pagination Pagination, filter string, args ...any) (PagingResult[T], error)
- func (dao *BaseDaoImpl[T]) SetDB(db *gorm.DB) *BaseDaoImpl[T]
- func (dao BaseDaoImpl[T]) Update(obj *T) (err error)
- func (dao BaseDaoImpl[T]) UpdateBy(obj *T, value map[string]any) (err error)
- type BaseModel
- type BaseModelInt
- type BaseService
- type BaseServiceImpl
- func (service BaseServiceImpl[T]) Create(obj T)
- func (service BaseServiceImpl[T]) Delete(obj T)
- func (service BaseServiceImpl[T]) DeleteByID(id string)
- func (service BaseServiceImpl[T]) GetByID(id string) (obj T)
- func (service BaseServiceImpl[T]) GetList() (objs []T)
- func (service BaseServiceImpl[T]) GetPage(pagination Pagination) (objs []T)
- func (service BaseServiceImpl[T]) Update(obj T)
- type IModel
- type Pagination
- type PagingResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseDaoImpl ¶
type BaseDaoImpl[T IModel] struct { // contains filtered or unexported fields }
func (BaseDaoImpl[T]) Delete ¶
func (dao BaseDaoImpl[T]) Delete(objs ...T) (err error)
Delete 根据对象删除
func (BaseDaoImpl[T]) DeleteBy ¶
func (dao BaseDaoImpl[T]) DeleteBy(filedName string, value ...string) (err error)
DeleteBy 通过一个或者多个id删除
func (BaseDaoImpl[T]) DeleteByIDs ¶
func (dao BaseDaoImpl[T]) DeleteByIDs(ids ...string) (err error)
DeleteByIDs 通过一个或者多个id删除
func (BaseDaoImpl[T]) GetAll ¶
func (dao BaseDaoImpl[T]) GetAll() (objs []T, err error)
GetAll 获取全部数据
func (BaseDaoImpl[T]) GetBy ¶
func (dao BaseDaoImpl[T]) GetBy(filedName string, value ...any) (objs []T, err error)
GetBy 获取多条数据
func (BaseDaoImpl[T]) GetByID ¶
func (dao BaseDaoImpl[T]) GetByID(id string) (obj T, err error)
GetByID 根据id查询
func (BaseDaoImpl[T]) GetByIDs ¶
func (dao BaseDaoImpl[T]) GetByIDs(ids ...string) (objs []T, err error)
GetByIDs 根据多个id查询
func (BaseDaoImpl[T]) GetOne ¶
func (dao BaseDaoImpl[T]) GetOne(filedName string, value any) (obj T, err error)
GetOne 根据字段查询
func (BaseDaoImpl[T]) GetPage ¶
func (dao BaseDaoImpl[T]) GetPage(pagination Pagination) (PagingResult[T], error)
GetPage 分页查询全部
func (BaseDaoImpl[T]) GetPageBy ¶
func (dao BaseDaoImpl[T]) GetPageBy(pagination Pagination, filter string, args ...any) (PagingResult[T], error)
GetPageBy 分页查询
func (*BaseDaoImpl[T]) SetDB ¶
func (dao *BaseDaoImpl[T]) SetDB(db *gorm.DB) *BaseDaoImpl[T]
type BaseModel ¶
type BaseModel struct { ID string `json:"id" gorm:"type:varchar(32);comment:主键"` // 主键ID CreateTime time.Time `json:"createTime" gorm:"autoCreateTime;comment:创建时间"` // 创建时间 UpdateTime time.Time `json:"updateTime" gorm:"autoUpdateTime;comment:更新时间"` // 更新时间 DeleteTime gorm.DeletedAt `json:"-" gorm:"index;comment:删除时间"` // 删除标记 Remarks string `json:"remarks" gorm:"default:null;comment:备注"` // 备注 }
type BaseModelInt ¶
type BaseModelInt struct { ID int `json:"id" gorm:"type:int;comment:主键"` // 主键ID CreatedAt time.Time `json:"createdAt" gorm:"comment:创建时间"` // 创建时间 UpdatedAt time.Time `json:"updatedAt" gorm:"comment:更新时间"` // 更新时间 DeletedAt gorm.DeletedAt `json:"-" gorm:"index;comment:删除时间"` // 删除时间 Remarks string `json:"remarks" gorm:"default:null;comment:备注"` // 备注 }
type BaseService ¶
type BaseServiceImpl ¶
type BaseServiceImpl[T IModel] struct { }
func (BaseServiceImpl[T]) Create ¶
func (service BaseServiceImpl[T]) Create(obj T)
func (BaseServiceImpl[T]) Delete ¶
func (service BaseServiceImpl[T]) Delete(obj T)
func (BaseServiceImpl[T]) DeleteByID ¶
func (service BaseServiceImpl[T]) DeleteByID(id string)
func (BaseServiceImpl[T]) GetByID ¶
func (service BaseServiceImpl[T]) GetByID(id string) (obj T)
func (BaseServiceImpl[T]) GetList ¶
func (service BaseServiceImpl[T]) GetList() (objs []T)
func (BaseServiceImpl[T]) GetPage ¶
func (service BaseServiceImpl[T]) GetPage(pagination Pagination) (objs []T)
func (BaseServiceImpl[T]) Update ¶
func (service BaseServiceImpl[T]) Update(obj T)
type Pagination ¶
type Pagination struct { PageSize int `json:"pageSize" uri:"pageSize"` Page int `json:"page" uri:"page"` Sort string `json:"sort" uri:"sort"` }
func NewPagination ¶
func NewPagination(pageSize, page int, sort string) Pagination
type PagingResult ¶
Click to show internal directories.
Click to hide internal directories.