Documentation ¶
Index ¶
- Constants
- func Convert[T any](sourceObj interface{}) T
- type BaseBll
- type BaseDao
- func (dao *BaseDao[T]) CheckExist(id uint64) bool
- func (dao *BaseDao[T]) Create(model *T) error
- func (dao *BaseDao[T]) CreateList(list []T) error
- func (dao *BaseDao[T]) DB() *gorm.DB
- func (dao *BaseDao[T]) Delete(id uint64) error
- func (dao *BaseDao[T]) DeleteCondition(condition string, args ...any) error
- func (dao *BaseDao[T]) GetAll() ([]T, error)
- func (dao *BaseDao[T]) GetCondition(query interface{}, args ...interface{}) (*T, error)
- func (dao *BaseDao[T]) GetConditions(query interface{}, args ...interface{}) ([]T, error)
- func (dao *BaseDao[T]) GetConditionsLimit(maxCount int, query interface{}, args ...interface{}) ([]*T, error)
- func (dao *BaseDao[T]) GetList(startId uint64, maxCount int) ([]T, error)
- func (dao *BaseDao[T]) GetModel(id uint64) (*T, error)
- func (dao *BaseDao[T]) Save(model *T) error
- func (dao *BaseDao[T]) Update(model *T) error
- type Date
- type DateTime
- func (d DateTime) Add(duration time.Duration) DateTime
- func (d DateTime) Date() Date
- func (d DateTime) DayFirstSecond() DateTime
- func (d DateTime) DayLastSecond() DateTime
- func (d *DateTime) FromTime(time time.Time)
- func (d DateTime) MarshalJSON() ([]byte, error)
- func (d DateTime) ToString() string
- func (d DateTime) ToTime() time.Time
- func (d *DateTime) UnmarshalJSON(data []byte) error
- type DbFull
- type DbSimple
- type File
- type QAdapter
- type QApiHandler
- type QBaseModule
- type QBll
- type QContext
- type QDao
- type QFail
- type QModule
- type QNoticeHandler
- type QWidget
Constants ¶
View Source
const ( ErrorCodeSubmit = 501 + iota // 提交操作失败(增删改) ErrorCodeTimeOut // 执行超时 ErrorCodeOSError // 系统故障,不可恢复 )
View Source
const ( RefuseCodeTokenInvalid = 401 + iota // Token无效或者已过期,需要重新登录 RefuseCodePermissionDenied // 权限不足,拒绝访问 RefuseCodeParamInvalid // 传入参数无效 RefuseCodeNoRecord // 记录不存在 RefuseCodeRecordExist //记录已存在 RefusePwdError //密码错误 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BaseDao ¶
type BaseDao[T any] struct { // contains filtered or unexported fields }
func (*BaseDao[T]) CheckExist ¶
CheckExist
@Description: 验证数据是否存在 @param id @return bool @return error
func (*BaseDao[T]) DeleteCondition ¶ added in v0.0.6
DeleteCondition
@Description: 自定义条件删除数据 @param condition @param args @return error
func (*BaseDao[T]) GetCondition ¶
GetCondition
@Description: 条件查询一条记录 @param query 条件,如 id = ? 或 id IN (?) 等 @param args 条件参数,如 id, ids 等 @return []*T @return error
func (*BaseDao[T]) GetConditions ¶
GetConditions
@Description: 条件查询一组列表 @param query 条件,如 id = ? 或 id IN (?) 等 @param args 条件参数,如 id, ids 等 @return []*T @return error
func (*BaseDao[T]) GetConditionsLimit ¶
func (dao *BaseDao[T]) GetConditionsLimit(maxCount int, query interface{}, args ...interface{}) ([]*T, error)
GetConditionsLimit
@Description: 条件查询一组列表 @param maxCount 最大数量 @param query 条件,如 id = ? 或 id IN (?) 等 @param args 条件参数,如 id, ids 等 @return []*T @return error
func (*BaseDao[T]) GetList ¶
GetList
@Description: 查询一组列表 @param startId 起始Id @param maxCount 最大数量 @return []*T @return error
type Date ¶
type Date uint32
type DateTime ¶
type DateTime uint64
type QAdapter ¶
type QAdapter interface { RegGet(router string, handler QApiHandler) RegPost(router string, handler QApiHandler) RegPut(router string, handler QApiHandler) RegDel(router string, handler QApiHandler) SendNotice(topic string, payload interface{}) }
type QApiHandler ¶
type QBaseModule ¶ added in v0.0.9
type QBaseModule struct { Stop func() StartInvoke func(route string, ctx QContext) *QFail EndInvoke func(route string, ctx QContext) }
func (*QBaseModule) OnEndInvoke ¶ added in v0.0.9
func (m *QBaseModule) OnEndInvoke(route string, ctx QContext)
func (*QBaseModule) OnStartInvoke ¶ added in v0.0.9
func (m *QBaseModule) OnStartInvoke(route string, ctx QContext) *QFail
func (*QBaseModule) OnStop ¶ added in v0.0.9
func (m *QBaseModule) OnStop()
type QContext ¶
type QContext interface { GetString(key string) string GetInt(key string) int GetUInt(key string) uint64 GetByte(key string) byte GetBool(key string) bool GetDate(key string) Date GetTime(key string) DateTime GetStruct(key string, objType reflect.Type) any GetList(listType reflect.Type) any GetFiles(key string) []File GetReturnValue() interface{} SetNewReturnValue(newValue interface{}) }
type QNoticeHandler ¶
type QNoticeHandler func(ctx QContext)
Click to show internal directories.
Click to hide internal directories.