Documentation ¶
Index ¶
- Variables
- func ArrayColumn(records []map[string]interface{}, name string) []interface{}
- func ArrayKeep(records []map[string]interface{}, keeps []string) []map[string]interface{}
- func ArrayMapSet(records []map[string]interface{}, key string, value interface{}) []map[string]interface{}
- func ArrayMapSetMapStr(records []maps.MapStr, key string, value interface{}) []maps.MapStr
- func ArrayPluck(columns []string, pluck map[string]interface{}) []map[string]interface{}
- func ArraySplit(records []map[string]interface{}) ([]string, [][]interface{})
- func ArrayStringUnique(columns []string) []string
- func ArrayTree(records []map[string]interface{}, setting map[string]interface{}) []map[string]interface{}
- func ArrayUnique(columns []interface{}) []interface{}
- func CaptchaMake(option CaptchaOption) (string, string)
- func CaptchaValidate(id string, code string) bool
- func Case(params ...CaseParam) interface{}
- func For(from int, to int, p Process)
- func IF(param CaseParam, paramElse ...CaseParam) interface{}
- func MapDel(record map[string]interface{}, key string) map[string]interface{}
- func MapGet(record map[string]interface{}, key string) interface{}
- func MapKeys(record map[string]interface{}) []string
- func MapMultiDel(record map[string]interface{}, keys ...string) map[string]interface{}
- func MapSet(record map[string]interface{}, key string, value interface{}) map[string]interface{}
- func MapValues(record map[string]interface{}) []interface{}
- func PasswordValidate(password string, passwordHash string) bool
- func ProcessArrayColumn(process *process.Process) interface{}
- func ProcessArrayGet(process *process.Process) interface{}
- func ProcessArrayIndexes(process *process.Process) interface{}
- func ProcessArrayKeep(process *process.Process) interface{}
- func ProcessArrayMapSet(process *process.Process) interface{}
- func ProcessArrayPluck(process *process.Process) interface{}
- func ProcessArraySplit(process *process.Process) interface{}
- func ProcessArrayTree(process *process.Process) interface{}
- func ProcessArrayUnique(process *process.Process) interface{}
- func ProcessCaptcha(process *process.Process) interface{}
- func ProcessCaptchaValidate(process *process.Process) interface{}
- func ProcessCase(process *process.Process) interface{}
- func ProcessEach(process *process.Process) interface{}
- func ProcessEnvGet(process *process.Process) interface{}
- func ProcessEnvMultiGet(process *process.Process) interface{}
- func ProcessEnvMultiSet(process *process.Process) interface{}
- func ProcessEnvSet(process *process.Process) interface{}
- func ProcessFor(process *process.Process) interface{}
- func ProcessHexToString(process *process.Process) interface{}
- func ProcessIF(process *process.Process) interface{}
- func ProcessJwtMake(process *process.Process) interface{}
- func ProcessJwtValidate(process *process.Process) interface{}
- func ProcessMapDel(process *process.Process) interface{}
- func ProcessMapGet(process *process.Process) interface{}
- func ProcessMapKeys(process *process.Process) interface{}
- func ProcessMapMultiDel(process *process.Process) interface{}
- func ProcessMapSet(process *process.Process) interface{}
- func ProcessMapToArray(process *process.Process) interface{}
- func ProcessMapValues(process *process.Process) interface{}
- func ProcessPasswordValidate(process *process.Process) interface{}
- func ProcessPrint(process *process.Process) interface{}
- func ProcessReturn(process *process.Process) interface{}
- func ProcessSleep(process *process.Process) interface{}
- func ProcessStrConcat(process *process.Process) interface{}
- func ProcessThrow(process *process.Process) interface{}
- func Range(v interface{}, process Process)
- func When(conds []Condition) bool
- type ArrayPluckValue
- type ArrayTreeOption
- type CaptchaOption
- type CaseParam
- type ComputeFunc
- type Condition
- type JwtClaims
- type JwtToken
- type Process
Constants ¶
This section is empty.
Variables ¶
var Computes = map[string]ComputeFunc{ "=": func(left interface{}, right interface{}) bool { return left == right }, ">": func(left interface{}, right interface{}) bool { return any.Of(left).CFloat64() == any.Of(right).CFloat64() }, ">=": func(left interface{}, right interface{}) bool { return any.Of(left).CFloat64() >= any.Of(right).CFloat64() }, "<": func(left interface{}, right interface{}) bool { return any.Of(left).CFloat64() < any.Of(right).CFloat64() }, "<=": func(left interface{}, right interface{}) bool { return any.Of(left).CFloat64() <= any.Of(right).CFloat64() }, "!=": func(left interface{}, right interface{}) bool { return left != right }, "hasprefix": func(left interface{}, right interface{}) bool { return strings.HasPrefix(fmt.Sprintf("%v", left), fmt.Sprintf("%v", right)) }, "hassuffix": func(left interface{}, right interface{}) bool { return strings.HasSuffix(fmt.Sprintf("%v", left), fmt.Sprintf("%v", right)) }, "contains": func(left interface{}, right interface{}) bool { return strings.Contains(fmt.Sprintf("%v", left), fmt.Sprintf("%v", right)) }, "match": func(left interface{}, right interface{}) bool { re := regexp.MustCompile(fmt.Sprintf("%v", right)) return re.Match([]byte(fmt.Sprintf("%v", left))) }, "is": func(left interface{}, right interface{}) bool { if is, ok := right.(string); ok { is = strings.ToLower(is) if is == "null" { return left == nil } else if is == "notnull" { return left != nil } } return false }, }
Computes 可用计算式
Functions ¶
func ArrayColumn ¶
ArrayColumn 返回多条数据记录,指定字段数值。
func ArrayMapSet ¶
func ArrayMapSet(records []map[string]interface{}, key string, value interface{}) []map[string]interface{}
ArrayMapSet []map[string]interface{} 设定数值
func ArrayMapSetMapStr ¶
ArrayMapSetMapStr []map[string]interface{} 设定数值
func ArrayPluck ¶
ArrayPluck 将多个数据记录集合,合并为一个数据记录集合
columns: ["城市", "行业", "计费"] pluck: { "行业":{"key":"city", "value":"数量", "items":[{"city":"北京", "数量":32},{"city":"上海", "数量":20}]}, "计费":{"key":"city", "value":"计费种类", "items":[{"city":"北京", "计费种类":6},{"city":"西安", "计费种类":3}]}, }
return: [
{"城市":"北京", "行业":32, "计费":6}, {"城市":"上海", "行业":20, "计费":null}, {"城市":"西安", "行业":null, "计费":6}
]
func ArraySplit ¶
ArraySplit 将多条数记录集合,分解为一个 columns:[]string 和 values: [][]interface{}
func ArrayTree ¶
func ArrayTree(records []map[string]interface{}, setting map[string]interface{}) []map[string]interface{}
ArrayTree []map[string]interface{} 转树形结构
func MapMultiDel ¶
MapMultiDel xiang.helper.MapMultiDel 删除数值并返回新映射表
func PasswordValidate ¶
PasswordValidate 校验密码
func ProcessArrayColumn ¶
ProcessArrayColumn xiang.helper.ArrayColumn 返回多条数据记录,指定字段数值。
func ProcessArrayGet ¶
ProcessArrayGet xiang.helper.ArrayGet 返回指定索引数据
func ProcessArrayIndexes ¶
ProcessArrayIndexes xiang.helper.ArrayIndexes 返回数组索引。
func ProcessArrayKeep ¶
ProcessArrayKeep xiang.helper.ArrayKeep 仅保留指定键名的数据
func ProcessArrayMapSet ¶
ProcessArrayMapSet xiang.helper.ArrayMapSet 数组映射设定数值
func ProcessArrayPluck ¶
ProcessArrayPluck xiang.helper.ArrayPluck 将多个数据记录集合,合并为一个数据记录集合
func ProcessArraySplit ¶
ProcessArraySplit xiang.helper.ArraySplit 将多条数记录集合,分解为一个 columns:[]string 和 values: [][]interface{}
func ProcessArrayTree ¶
ProcessArrayTree xiang.helper.ArrayTree 转换为属性结构
func ProcessArrayUnique ¶
ProcessArrayUnique xiang.helper.ArrayUnique 数组排重
func ProcessCaptcha ¶
ProcessCaptcha xiang.helper.Captcha 校验图形/音频验证码
func ProcessCaptchaValidate ¶
ProcessCaptchaValidate xiang.helper.CaptchaValidate 校验图形/音频验证码
func ProcessCase ¶
ProcessCase xiang.helper.Case Case条件判断
func ProcessEach ¶
ProcessEach xiang.helper.Each 循环过程控制
func ProcessEnvGet ¶
ProcessEnvGet xiang.helper.EnvGet 读取ENV
func ProcessEnvMultiGet ¶
ProcessEnvMultiGet xiang.helper.MultiGet 读取ENV
func ProcessEnvMultiSet ¶
ProcessEnvMultiSet xiang.helper.MultiSet 设置ENV
func ProcessEnvSet ¶
ProcessEnvSet xiang.helper.EnvSet 设置ENV
func ProcessFor ¶
ProcessFor xiang.helper.For 循环过程控制
func ProcessHexToString ¶ added in v0.9.2
ProcessHexToString xiang.helper.HexToString
func ProcessJwtMake ¶
ProcessJwtMake xiang.helper.JwtMake 生成JWT
func ProcessJwtValidate ¶
ProcessJwtValidate xiang.helper.JwtValidate 校验JWT
func ProcessMapDel ¶
ProcessMapDel xiang.helper.MapDel 删除给定键, 返回映射表
func ProcessMapGet ¶
ProcessMapGet xiang.helper.MapGet 返回映射表给定键的值
func ProcessMapKeys ¶
ProcessMapKeys xiang.helper.MapKeys 返回映射表的键
func ProcessMapMultiDel ¶
ProcessMapMultiDel xiang.helper.MapMultiDel 删除一组给定键, 返回映射表
func ProcessMapSet ¶
ProcessMapSet xiang.helper.MapSet 设定键值,返回映射表给定键的值
func ProcessMapToArray ¶
ProcessMapToArray xiang.helper.MapToArray 映射转换为 KeyValue 数组
func ProcessMapValues ¶
ProcessMapValues xiang.helper.MapValues 返回映射表的数值
func ProcessPasswordValidate ¶
ProcessPasswordValidate xiang.helper.PasswordValidate 校验密码
func ProcessPrint ¶
ProcessPrint xiang.helper.Print 打印语句
func ProcessReturn ¶
ProcessReturn xiang.helper.Return 返回数值
func ProcessSleep ¶
ProcessSleep xiang.flow.Sleep 等待
func ProcessStrConcat ¶
ProcessStrConcat xiang.helper.StrConcat 连接字符串
func ProcessThrow ¶
ProcessThrow xiang.helper.Throw 抛出异常
Types ¶
type ArrayPluckValue ¶
type ArrayPluckValue struct { Key string `json:"key"` Value string `json:"value"` Items []map[string]interface{} `json:"items"` }
ArrayPluckValue ArrayPluck 参数
func OfArrayPluckValue ¶
func OfArrayPluckValue(any interface{}) ArrayPluckValue
OfArrayPluckValue Any 转 ArrayPluckValue
type ArrayTreeOption ¶
type ArrayTreeOption struct { Key string `json:"id"` // 主键名称, 默认为 id Empty interface{} `json:"empty"` // Top节点 parent 数值, 默认为 0 Parent string `json:"parent"` // 父节点字段名称, 默认为 parent Children string `json:"children"` // 子节点字段名称, 默认为 children }
ArrayTreeOption Array转树形结构参数表
func NewArrayTreeOption ¶
func NewArrayTreeOption(option map[string]interface{}) ArrayTreeOption
NewArrayTreeOption 创建配置
func (ArrayTreeOption) Tree ¶
func (opt ArrayTreeOption) Tree(records []map[string]interface{}) []map[string]interface{}
Tree Array 转换为 Tree
type CaptchaOption ¶
type CaptchaOption struct { Type string Height int Width int Length int Lang string Background string }
CaptchaOption 验证码配置
type CaseParam ¶
type CaseParam struct { When []Condition `json:"when"` Name string `json:"name"` Process string `json:"process"` Args []interface{} `json:"args"` }
CaseParam 条件参数
type Condition ¶
type Condition struct { Left interface{} `json:"left"` Right interface{} `json:"right"` Compute ComputeFunc `json:"-"` OP string `json:"op"` OR bool `json:"or"` Comment string `json:"comment"` }
Condition 判断条件
func ConditionOf ¶
ConditionOf 从 map[string]interface{}
func (Condition) MarshalJSON ¶
MarshalJSON for json marshalJSON
func (*Condition) UnmarshalJSON ¶
UnmarshalJSON for json marshalJSON
type JwtClaims ¶
type JwtClaims struct { ID int `json:"id"` SID string `json:"sid"` Data map[string]interface{} `json:"data"` jwt.StandardClaims }
JwtClaims 用户Token
func JwtValidate ¶
JwtValidate JWT 校验