Documentation
¶
Index ¶
- type ApiVersion
- type BodyProperty
- type DayStatRequest
- type HttpContext
- func (sc *HttpContext) Deadline() (deadline time.Time, ok bool)
- func (sc *HttpContext) Done() <-chan struct{}
- func (sc *HttpContext) Err() error
- func (sc *HttpContext) GetUser() *User
- func (sc *HttpContext) HasRole(roles []IRole) bool
- func (sc *HttpContext) IsRole(role IRole) bool
- func (sc *HttpContext) Logger() xlog.XLogger
- func (sc *HttpContext) Set(key string, value interface{})
- func (sc *HttpContext) StorageTo(ctx *gin.Context) bool
- func (sc *HttpContext) TraceId() string
- func (sc *HttpContext) User() *User
- func (sc *HttpContext) Value(key interface{}) interface{}
- type IRole
- type ResponseModel
- type SearchRequest
- type ToRole
- type User
- func (u *User) GetAccount() string
- func (u *User) GetExtend() map[string]string
- func (u *User) GetExtendValue(field string) string
- func (u *User) GetID() uint
- func (u *User) GetIP() string
- func (u *User) GetName() string
- func (u *User) GetRoles() []IRole
- func (u *User) Is(role IRole, others ...IRole) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiVersion ¶
type ApiVersion string
ApiVersion 版本号
func (ApiVersion) Verify ¶
func (av ApiVersion) Verify() bool
type BodyProperty ¶
type BodyProperty string
BodyProperty 响应正文属性
const ( BodyPropertyRaw BodyProperty = "raw" BodyPropertyText BodyProperty = "text" BodyPropertyHtml BodyProperty = "html" BodyPropertyFull BodyProperty = "full" )
func (BodyProperty) Verify ¶
func (bp BodyProperty) Verify() bool
type DayStatRequest ¶ added in v1.2.0
type DayStatRequest struct { SearchRequest StartDay string `form:"startDay" format:"2006-01-02"` EndDay string `form:"endDay" format:"2006-01-02"` }
DayStatRequest 通用日统计请求。都为空时,默认获取当周数据
func (DayStatRequest) StatAtRange ¶ added in v1.2.0
func (in DayStatRequest) StatAtRange() ([]time.Time, error)
func (DayStatRequest) StatAtRangeOrLastWeek ¶ added in v1.2.0
func (in DayStatRequest) StatAtRangeOrLastWeek() []time.Time
func (DayStatRequest) StatDayRange ¶ added in v1.2.0
func (in DayStatRequest) StatDayRange() ([]uint, error)
func (DayStatRequest) StatDayRangeOrLastWeek ¶ added in v1.2.0
func (in DayStatRequest) StatDayRangeOrLastWeek() []uint
type HttpContext ¶
type HttpContext struct {
// contains filtered or unexported fields
}
func MustParseHttpContext ¶ added in v1.2.0
func MustParseHttpContext(ctx context.Context) (*HttpContext, error)
MustParseHttpContext 从 gin 上下文中解析自定义上下文
func ParserHttpContext ¶
func ParserHttpContext(ctx context.Context) (*HttpContext, error)
ParserHttpContext 从 gin 上下文中解析自定义上下文 Deprecated. use MustParseHttpContext
func (*HttpContext) Done ¶
func (sc *HttpContext) Done() <-chan struct{}
func (*HttpContext) Err ¶
func (sc *HttpContext) Err() error
func (*HttpContext) GetUser ¶ added in v1.2.0
func (sc *HttpContext) GetUser() *User
func (*HttpContext) Logger ¶
func (sc *HttpContext) Logger() xlog.XLogger
func (*HttpContext) Set ¶
func (sc *HttpContext) Set(key string, value interface{})
Set 设置参数 会根据 value 的类型,自动设置对应属性的值,目前支持: ApiVersion, BodyProperty, types.User, xlog.XLogger
func (*HttpContext) StorageTo ¶
func (sc *HttpContext) StorageTo(ctx *gin.Context) bool
StorageTo 将已变更的数据,存储到 gin 上下文中,继续传输
func (*HttpContext) TraceId ¶
func (sc *HttpContext) TraceId() string
func (*HttpContext) User ¶
func (sc *HttpContext) User() *User
func (*HttpContext) Value ¶
func (sc *HttpContext) Value(key interface{}) interface{}
type ResponseModel ¶ added in v1.2.0
type ResponseModel struct { ID uint `json:"id" copy:"ID"` CreatedTime string `json:"createdTime" copy:"createdAt"` UpdatedTime string `json:"updatedTime" copy:"updatedAt"` }
ResponseModel 通用响应基础模型
type SearchRequest ¶
type SearchRequest struct { // 数据开始位置 Start int64 `form:"start"` // 返回数据条数 Limit int64 `form:"limit"` // 排序规则:sort=otc_type,-created_at,*custom // 以符号开头,可选符号:(+或空 正序)(- 倒序)(* 自定义复杂排序标识关键词) Sort string `form:"sort"` }
SearchRequest 通用搜索请求
Click to show internal directories.
Click to hide internal directories.