Documentation ¶
Index ¶
- Constants
- Variables
- func Convert(handler interface{}) gin.HandlerFunc
- func Error(err error, msg ...string)
- func Unwrap(result any, err error) any
- func UnwrapOrEmpty(result string, err error) string
- type AnyResponder
- type Athena
- func (this *Athena) Attach(f interfaces.IFairing) *Athena
- func (this *Athena) Beans(beans ...any) *Athena
- func (this *Athena) Configuration(cfgs ...any) *Athena
- func (this *Athena) CronTask(expr string, f func()) *Athena
- func (this *Athena) Handle(httpMethod, relativePath string, handler interface{}) *Athena
- func (this *Athena) Launch()
- func (this *Athena) MappingConfig(entity config.IConfig, decoderConfigOpts ...viper.DecoderConfigOption) *Athena
- func (this *Athena) Mount(group string, fs []interfaces.IFairing, classes ...IClass) *Athena
- func (this *Athena) RegisterPlugin(plugins ...interfaces.IPlugin) *Athena
- type Collection
- type CollectionResponder
- type Conditions
- type DateTime
- type DbQuery
- func (this *DbQuery) AddFields(fields ...string) *DbQuery
- func (this *DbQuery) AddJoins(joins ...*Join) *DbQuery
- func (this *DbQuery) AddPreloads(preloads ...*Preload) *DbQuery
- func (this *DbQuery) SetBuildOpts(build *gorm.DB) *gorm.DB
- func (this *DbQuery) SetCountBuildOpts(countBuild *gorm.DB) *gorm.DB
- func (this *DbQuery) SetDb(db *gorm.DB) *DbQuery
- func (this *DbQuery) SetDebug() *DbQuery
- func (this *DbQuery) SetOrder(order string) *DbQuery
- func (this *DbQuery) SetWhere(where *Conditions) *DbQuery
- type IClass
- type Join
- type Json
- type JsonResponder
- type Model
- type Models
- type Page
- type Preload
- type Responder
- type Response
- type StringResponder
- type Void
- type VoidResponder
Constants ¶
View Source
const ( CtxHttpStatusCode = "athena_httpStatusCode" CtxCode = "athena_code" CtxMessage = "athena_message" )
View Source
const DateFormat = "2006-01-02"
View Source
const DateTimeFormat = "2006-01-02 15:04:05"
Variables ¶
View Source
var ResponderList []Responder
View Source
var ResponsePool *sync.Pool
Functions ¶
func Convert ¶
func Convert(handler interface{}) gin.HandlerFunc
func UnwrapOrEmpty ¶
Types ¶
type AnyResponder ¶
func (AnyResponder) RespondTo ¶
func (this AnyResponder) RespondTo() gin.HandlerFunc
type Athena ¶
func (*Athena) Configuration ¶
Configuration 定义配置类,会被自动扫描注册到bean对象
func (*Athena) MappingConfig ¶
func (this *Athena) MappingConfig(entity config.IConfig, decoderConfigOpts ...viper.DecoderConfigOption) *Athena
MappingConfig 映射配置文件到实体对象中
func (*Athena) RegisterPlugin ¶
func (this *Athena) RegisterPlugin(plugins ...interfaces.IPlugin) *Athena
RegisterPlugin 注册插件
type Collection ¶
Collection 分页集合
func NewCollection ¶
func NewCollection(items any, page *Page) *Collection
type CollectionResponder ¶
type CollectionResponder func(ctx *gin.Context) Collection
func (CollectionResponder) RespondTo ¶
func (this CollectionResponder) RespondTo() gin.HandlerFunc
type Conditions ¶
Conditions 自定义 where 条件
func NewConditions ¶
func NewConditions(query any, args ...any) *Conditions
func NewConditionsWithQuery ¶
func NewConditionsWithQuery(query any) *Conditions
NewConditionsWithQuery 根据注解生成 where 条件
type DbQuery ¶ added in v1.0.8
type DbQuery struct { Db *gorm.DB `json:"-"` Debug bool `json:"-"` Order string `json:"-"` Fields []string `json:"-"` Preloads []*Preload `json:"-"` Joins []*Join `json:"-"` Where *Conditions `json:"-"` }
DbQuery 查询对象
func NewDbQuery ¶ added in v1.0.8
func NewDbQuery() *DbQuery
func (*DbQuery) AddPreloads ¶ added in v1.0.8
AddPreloads 设置预加载
func (*DbQuery) SetBuildOpts ¶ added in v1.0.8
SetCountBuildOpts 设置查询选项
func (*DbQuery) SetCountBuildOpts ¶ added in v1.0.8
SetCountBuildOpts 设置统计数量的查询选项
func (*DbQuery) SetWhere ¶ added in v1.0.8
func (this *DbQuery) SetWhere(where *Conditions) *DbQuery
SetWhere 设置查询条件
type JsonResponder ¶
func (JsonResponder) RespondTo ¶
func (this JsonResponder) RespondTo() gin.HandlerFunc
type Page ¶
type Page struct { *DbQuery CurrentPage int `json:"current_page"` // 当前页 PerPage int `json:"per_page"` // 每页条数 TotalSize int64 `json:"total_size"` // 总条数 TotalPage int `json:"total_page"` // 总页数 Extend any `json:"extend,omitempty"` // 扩展字段 }
Page 快速分页对象
type Responder ¶
type Responder interface {
RespondTo() gin.HandlerFunc
}
type StringResponder ¶
func (StringResponder) RespondTo ¶
func (this StringResponder) RespondTo() gin.HandlerFunc
type VoidResponder ¶
func (VoidResponder) RespondTo ¶
func (this VoidResponder) RespondTo() gin.HandlerFunc
Click to show internal directories.
Click to hide internal directories.