项目地址:go-expression 目前发布初始版本,欢迎体验。 float64比较
expression EL表达式
Install
go get github.com/heartlhj/go-expression
功能
context := spel.StandardEvaluationContext{} m := make(map[string]interface{}) m["name"] = "lisi" m["age"] = 18 context.SetVariables(m) parser := SpelExpressionParser{} expressionString := "#name=='lisi'" //expressionString := "#name" //返回lisi valueContext := parser.ParseExpression(expressionString).GetValueContext(&context)
context := spel.StandardEvaluationContext{} m := make(map[string]interface{}) m["name"] = "lisi" m["age"] = 18 context.SetVariables(m) parser := SpelExpressionParser{} expressionString := "#age>=10" valueContext := parser.ParseExpression(expressionString).GetValueContext(&context)
context := spel.StandardEvaluationContext{} m := make(map[string]interface{}) var ageFloat float64 ageFloat = 10 m["num"] = ageFloat context.SetVariables(m) parser := SpelExpressionParser{} expressionString := "#num>=9f" valueContext := parser.ParseExpression(expressionString).GetValueContext(&context)
context := spel.StandardEvaluationContext{} m := make(map[string]interface{}) m["name"] = "lisi" m["age"] = 18 context.SetVariables(m) parser := SpelExpressionParser{} expressionString := "#name=='lisi' && #age>=3" valueContext := parser.ParseExpression(expressionString).GetValueContext(&context)
context := spel.StandardEvaluationContext{} context.AddPropertyAccessor(spel.MapAccessor{}) m := make(map[string]interface{}) m["name"] = "lisi" m["age"] = 18 m1 := make(map[string]interface{}) m2 := make(map[string]interface{}) m2["num"] = 12 m1["code"] = m2 m["order"] = m1 context.SetVariables(m) parser := SpelExpressionParser{} expressionString := "#order.code.num==12" valueContext := parser.ParseExpression(expressionString).GetValueContext(&context)
context := spel.StandardEvaluationContext{} context.AddPropertyAccessor(spel.MapAccessor{}) m := make(map[string]interface{}) m["name"] = "lisi" m["age"] = 18 m1 := make(map[string]interface{}) //切片 //orders := make([]Order, 2) //数组 orders := [2]Order{} orders[0] = Order{name: "lisi", age: 12} orders[1] = Order{name: "wang", age: 24} m1["code"] = orders m["order"] = m1 context.SetVariables(m) parser := SpelExpressionParser{} expressionString := "#order.code[0].name=='lisi'" valueContext := parser.ParseExpression(expressionString).GetValueContext(&context)
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算