Documentation
¶
Index ¶
- Constants
- Variables
- func IsLimitKey(str string) bool
- func IsOrderKey(str string) bool
- func IsQueryAnonymousKey(str string) bool
- func IsQueryKey(str string) bool
- type ILimit
- type IOrder
- type IParser
- type IQuery
- type IRuleLimit
- type IRuleMapping
- type LimitRoot
- type LimitValue
- type LimitValues
- type OrderRoot
- type OrderValue
- type Parser
- type QueryElem
- type QueryRoot
- type QueryValue
- type RuleLimit
- type RuleMapping
Constants ¶
View Source
const ( LimitKeyLimit string = "%l" // 数量限制 LimitKeySkip = "%s" // 位移数量 LimitKeyPage = "%p" // 页数,从0开始 )
View Source
const ( OrderKeyASC string = "+" // 正序 OrderKeyDESC = "-" // 反序 )
View Source
const ( QueryKeyAnd string = "%and" // AND 与 QueryKeyOr = "%or" // OR 或 )
View Source
const ( QueryKeyEq string = "%eq" // 等于 QueryKeyNe = "%ne" // 不等于 QueryKeyLt = "%lt" // 小于 QueryKeyLte = "%lte" // 小于等于 QueryKeyGt = "%gt" // 大于 QueryKeyGte = "%gte" // 大于等于 QueryKeyLike = "%like" // 模糊搜索 QueryKeyIn = "%in" // 在...之中 QueryKeyBetween = "%bt" // 在...之间 QueryKeyNotBetween = "%nbt" // 不在...之间 )
View Source
const (
OrderKey string = "%o"
)
Variables ¶
View Source
var ( ErrTypeNil error = errors.New("gosql: interface{} must not be nil") ErrTypeMap = errors.New("gosql: interface{} must be type of map[string]interface{}") ErrTypeString = errors.New("gosql: interface{} must be type of string") ErrTypeInt = errors.New("gosql: interface{} must be type of int") ErrTypeValue = errors.New("gosql: invalid value") )
Functions ¶
func IsLimitKey ¶
func IsOrderKey ¶
func IsQueryAnonymousKey ¶
func IsQueryKey ¶
Types ¶
type IRuleLimit ¶
type IRuleLimit interface {
SetMaxLimit(int) IRuleLimit
GetLimit(int) int
}
type IRuleMapping ¶
type IRuleMapping interface {
Allow(...string) IRuleMapping
Disallow(...string) IRuleMapping
IsAllowed(string) bool
SetMapping(string, string) IRuleMapping
GetMapping(string) string
}
type LimitValue ¶
func (*LimitValue) IsLimited ¶
func (l *LimitValue) IsLimited() bool
func (*LimitValue) Parse ¶
func (l *LimitValue) Parse(obj interface{}) error
type LimitValues ¶
func (*LimitValues) GetSkip ¶
func (l *LimitValues) GetSkip() int
func (*LimitValues) IsLimited ¶
func (l *LimitValues) IsLimited() bool
type OrderValue ¶
func (*OrderValue) IsASC ¶
func (o *OrderValue) IsASC() bool
func (*OrderValue) IsDESC ¶
func (o *OrderValue) IsDESC() bool
func (*OrderValue) Parse ¶
func (o *OrderValue) Parse(obj interface{}) error
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
func (*Parser) ParseJSONString ¶
type QueryElem ¶
type QueryElem struct {
RelKey string
Key string
Values []IQuery
// contains filtered or unexported fields
}
func (*QueryElem) IsAnonymous ¶
type QueryRoot ¶
type QueryRoot struct {
Values []IQuery
}
func (*QueryRoot) IsAnonymous ¶
func (*QueryRoot) ParseJSONString ¶
type QueryValue ¶
func (*QueryValue) IsAnonymous ¶
func (q *QueryValue) IsAnonymous() bool
func (*QueryValue) Parse ¶
func (q *QueryValue) Parse(obj interface{}) error
type RuleLimit ¶
type RuleLimit struct {
// contains filtered or unexported fields
}
func (*RuleLimit) SetMaxLimit ¶
func (l *RuleLimit) SetMaxLimit(lmt int) IRuleLimit
type RuleMapping ¶
type RuleMapping struct {
// contains filtered or unexported fields
}
func (*RuleMapping) Allow ¶
func (r *RuleMapping) Allow(keys ...string) IRuleMapping
func (*RuleMapping) Disallow ¶
func (r *RuleMapping) Disallow(keys ...string) IRuleMapping
func (*RuleMapping) GetMapping ¶
func (r *RuleMapping) GetMapping(value string) string
func (*RuleMapping) IsAllowed ¶
func (r *RuleMapping) IsAllowed(key string) bool
func (*RuleMapping) SetMapping ¶
func (r *RuleMapping) SetMapping(value, mapping string) IRuleMapping
Source Files
¶
Click to show internal directories.
Click to hide internal directories.