本文整理汇总了Golang中github.com/araddon/qlbridge/value.NewBoolValue函数的典型用法代码示例。如果您正苦于以下问题:Golang NewBoolValue函数的具体用法?Golang NewBoolValue怎么用?Golang NewBoolValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewBoolValue函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: walkUnary
func walkUnary(ctx expr.EvalContext, node *expr.UnaryNode) (value.Value, bool) {
a, ok := Eval(ctx, node.Arg)
if !ok {
if node.Operator.T == lex.TokenExists {
return value.NewBoolValue(false), true
}
u.Debugf("urnary could not evaluate %#v", node)
return a, false
}
switch node.Operator.T {
case lex.TokenNegate:
switch argVal := a.(type) {
case value.BoolValue:
//u.Infof("found urnary bool: res=%v expr=%v", !argVal.v, node.StringAST())
return value.NewBoolValue(!argVal.Val()), true
default:
//u.Errorf("urnary type not implementedUnknonwn node type: %T", argVal)
panic(ErrUnknownNodeType)
}
case lex.TokenMinus:
if an, aok := a.(value.NumericValue); aok {
return value.NewNumberValue(-an.Float()), true
}
case lex.TokenExists:
return value.NewBoolValue(true), true
default:
u.Warnf("urnary not implemented for type %s %#v", node.Operator.T.String(), node)
}
return value.NewNilValue(), false
}
开发者ID:schmichael,项目名称:qlbridge,代码行数:32,代码来源:vm.go
示例2: walkMulti
// MultiNode evaluator
//
// A IN (b,c,d)
//
func walkMulti(ctx expr.EvalContext, node *expr.MultiArgNode) (value.Value, bool) {
a, aok := Eval(ctx, node.Args[0])
//u.Infof("multi: %T:%v %v", a, a, node.Operator)
if !aok {
u.Infof("Could not evaluate args, %#v", node.Args[0])
return value.BoolValueFalse, false
}
switch node.Operator.T {
case lex.TokenIN:
for i := 1; i < len(node.Args); i++ {
v, ok := Eval(ctx, node.Args[i])
if ok {
//u.Debugf("in? %v %v", a, v)
if eq, err := value.Equal(a, v); eq && err == nil {
return value.NewBoolValue(true), true
}
} else {
u.Warnf("could not evaluate arg: %v", node.Args[i])
}
}
return value.NewBoolValue(false), true
default:
u.Warnf("tri node walk not implemented: %#v", node)
}
return value.NewNilValue(), false
}
开发者ID:chrislusf,项目名称:qlbridge,代码行数:32,代码来源:vm.go
示例3: TestSqlDelete
func TestSqlDelete(t *testing.T) {
db := datasource.NewContextSimple()
user1 := map[string]value.Value{
"user_id": value.NewIntValue(5),
"item_count": value.NewStringValue("5"),
"bval": value.NewBoolValue(true),
"bvalf": value.NewBoolValue(false),
"reg_date": value.NewStringValue("2014/11/01"),
"name": value.NewStringValue("bob")}
db.Insert(user1)
user2 := map[string]value.Value{
"user_id": value.NewIntValue(6),
"item_count": value.NewStringValue("5"),
"reg_date": value.NewStringValue("2012/11/01"),
"name": value.NewStringValue("allison")}
db.Insert(user2)
assert.Tf(t, len(db.Rows) == 2, "has 2 users")
verifySqlDelete(t, `
DELETE FROM mytable
WHERE yy(reg_date) == 14
`, db)
assert.Tf(t, len(db.Rows) == 1, "must have 1 rows: %v %v", len(db.Rows), db.Rows)
assert.Tf(t, db.Rows[0]["name"].ToString() == "allison", "%v", db.Rows)
}
开发者ID:kyledj,项目名称:qlbridge,代码行数:26,代码来源:vm_sql_test.go
示例4: walkTri
// TriNode evaluator
//
// A BETWEEN B AND C
//
func walkTri(ctx expr.EvalContext, node *expr.TriNode) (value.Value, bool) {
a, aok := Eval(ctx, node.Args[0])
b, bok := Eval(ctx, node.Args[1])
c, cok := Eval(ctx, node.Args[2])
//u.Infof("tri: %T:%v %v %T:%v %T:%v", a, a, node.Operator, b, b, c, c)
if !aok {
return value.BoolValueFalse, false
}
if !bok || !cok {
u.Debugf("Could not evaluate args, %#v", node.String())
return value.BoolValueFalse, false
}
if a == nil || b == nil || c == nil {
return value.BoolValueFalse, false
}
switch node.Operator.T {
case lex.TokenBetween:
switch a.Type() {
case value.IntType:
//u.Infof("found tri: %v %v %v expr=%v", a, b, c, node.StringAST())
if aiv, ok := a.(value.IntValue); ok {
if biv, ok := b.(value.IntValue); ok {
if civ, ok := c.(value.IntValue); ok {
if aiv.Int() > biv.Int() && aiv.Int() < civ.Int() {
return value.NewBoolValue(true), true
} else {
return value.NewBoolValue(false), true
}
}
}
}
return value.BoolValueFalse, false
case value.NumberType:
//u.Infof("found tri: %v %v %v expr=%v", a, b, c, node.StringAST())
if afv, ok := a.(value.NumberValue); ok {
if bfv, ok := b.(value.NumberValue); ok {
if cfv, ok := c.(value.NumberValue); ok {
if afv.Float() > bfv.Float() && afv.Float() < cfv.Float() {
return value.NewBoolValue(true), false
} else {
return value.NewBoolValue(false), true
}
}
}
}
return value.BoolValueFalse, false
default:
u.Warnf("between not implemented for type %s %#v", a.Type().String(), node)
}
default:
u.Warnf("tri node walk not implemented: %#v", node)
}
return value.NewNilValue(), false
}
开发者ID:allisonmorgan,项目名称:qlbridge,代码行数:60,代码来源:vm.go
示例5: AnyFunc
// Any: Answers True/False if any of the arguments evaluate to truish (javascripty)
// type definintion of true
//
// int > 0 = true
// string != "" = true
//
//
// any(item,item2) => true, true
// any(not_field) => false, true
//
func AnyFunc(ctx expr.EvalContext, vals ...value.Value) (value.BoolValue, bool) {
for _, v := range vals {
if v.Err() || v.Nil() {
// continue
} else if !value.IsNilIsh(v.Rv()) {
return value.NewBoolValue(true), true
}
}
return value.NewBoolValue(false), true
}
开发者ID:kyledj,项目名称:qlbridge,代码行数:20,代码来源:builtins.go
示例6: Ne
// Not Equal function? returns true if items are equal
//
// ne(item,5)
func Ne(ctx expr.EvalContext, itemA, itemB value.Value) (value.BoolValue, bool) {
eq, err := value.Equal(itemA, itemB)
if err == nil {
return value.NewBoolValue(!eq), true
}
return value.BoolValueFalse, true
}
开发者ID:kyledj,项目名称:qlbridge,代码行数:10,代码来源:builtins.go
示例7: NotFunc
// Not: urnary negation function
//
// eq(item,5)
func NotFunc(ctx expr.EvalContext, item value.Value) (value.BoolValue, bool) {
boolVal, ok := value.ToBool(item.Rv())
if ok {
return value.NewBoolValue(!boolVal), true
}
return value.BoolValueFalse, false
}
开发者ID:kyledj,项目名称:qlbridge,代码行数:10,代码来源:builtins.go
示例8: Eq
// Equal function? returns true if items are equal
//
// eq(item,5)
func Eq(ctx expr.EvalContext, itemA, itemB value.Value) (value.BoolValue, bool) {
//return BoolValue(itemA == itemB)
//rvb := value.CoerceTo(itemA.Rv(), itemB.Rv())
//u.Infof("Eq(): a:%T b:%T %v=%v?", itemA, itemB, itemA.Value(), rvb)
//u.Infof("Eq()2: %T %T", itemA.Rv(), rvb)
return value.NewBoolValue(reflect.DeepEqual(itemA.Value(), itemB.Value())), true
}
开发者ID:schmichael,项目名称:qlbridge,代码行数:10,代码来源:vm_test.go
示例9: LeFunc
// <= Less Than or Equal
// Must be able to convert items to Floats or else not ok
//
func LeFunc(ctx expr.EvalContext, lv, rv value.Value) (value.BoolValue, bool) {
left, _ := value.ToFloat64(lv.Rv())
right, _ := value.ToFloat64(rv.Rv())
if math.IsNaN(left) || math.IsNaN(right) {
return value.BoolValueFalse, false
}
return value.NewBoolValue(left <= right), true
}
开发者ID:kyledj,项目名称:qlbridge,代码行数:11,代码来源:builtins.go
示例10: LtFunc
// < Less Than
// Must be able to convert items to Floats or else not ok
//
func LtFunc(ctx expr.EvalContext, lv, rv value.Value) (value.BoolValue, bool) {
left := value.ToFloat64(lv.Rv())
right := value.ToFloat64(rv.Rv())
if left == math.NaN() || right == math.NaN() {
return value.BoolValueFalse, false
}
return value.NewBoolValue(left < right), true
}
开发者ID:jmptrader,项目名称:qlbridge,代码行数:12,代码来源:builtins.go
示例11: walkMulti
// MultiNode evaluator
//
// A IN (b,c,d)
//
func walkMulti(ctx expr.EvalContext, node *expr.MultiArgNode) (value.Value, bool) {
a, aok := Eval(ctx, node.Args[0])
//u.Debugf("multi: %T:%v %v", a, a, node.Operator)
if !aok || a == nil || a.Type() == value.NilType {
// this is expected, most likely to missing data to operate on
//u.Debugf("Could not evaluate args, %#v", node.Args[0])
return value.BoolValueFalse, false
}
if node.Operator.T != lex.TokenIN {
u.Warnf("walk multiarg not implemented for node type %#v", node)
return value.NilValueVal, false
}
// Support `"literal" IN identity`
if len(node.Args) == 2 && node.Args[1].NodeType() == expr.IdentityNodeType {
ident := node.Args[1].(*expr.IdentityNode)
mval, ok := walkIdentity(ctx, ident)
if !ok {
// Failed to lookup ident
return value.BoolValueFalse, true
}
sval, ok := mval.(value.Slice)
if !ok {
u.Debugf("expected slice but received %T", mval)
return value.BoolValueFalse, false
}
for _, val := range sval.SliceValue() {
match, err := value.Equal(val, a)
if err != nil {
// Couldn't compare values
u.Debugf("IN: couldn't compare %s and %s", val, a)
continue
}
if match {
return value.BoolValueTrue, true
}
}
// No match, return false
return value.BoolValueFalse, true
}
for i := 1; i < len(node.Args); i++ {
v, ok := Eval(ctx, node.Args[i])
if ok && v != nil {
//u.Debugf("in? %v %v", a, v)
if eq, err := value.Equal(a, v); eq && err == nil {
return value.NewBoolValue(true), true
}
} else {
//u.Debugf("could not evaluate arg: %v", node.Args[i])
}
}
return value.BoolValueFalse, true
}
开发者ID:kyledj,项目名称:qlbridge,代码行数:61,代码来源:vm.go
示例12: Eq
// Equal function? returns true if items are equal
//
// eq(item,5)
//
func Eq(ctx expr.EvalContext, itemA, itemB value.Value) (value.BoolValue, bool) {
eq, err := value.Equal(itemA, itemB)
//u.Infof("EQ: %v %v ==? %v", itemA, itemB, eq)
if err == nil {
return value.NewBoolValue(eq), true
}
return value.BoolValueFalse, false
}
开发者ID:kyledj,项目名称:qlbridge,代码行数:13,代码来源:builtins.go
示例13: walkIdentity
func walkIdentity(ctx expr.EvalContext, node *expr.IdentityNode) (value.Value, bool) {
if node.IsBooleanIdentity() {
//u.Debugf("walkIdentity() boolean: node=%T %v Bool:%v", node, node, node.Bool())
return value.NewBoolValue(node.Bool()), true
}
if ctx == nil {
return value.NewStringValue(node.Text), true
}
return ctx.Get(node.Text)
}
开发者ID:allisonmorgan,项目名称:qlbridge,代码行数:11,代码来源:vm.go
示例14: AllFunc
// All: Answers True/False if all of the arguments evaluate to truish (javascripty)
// type definintion of true
//
// int > 0 = true
// string != "" = true
// boolean natively supported true/false
//
//
// all("hello",2, true) => true
// all("hello",0,true) => false
// all("",2, true) => false
//
func AllFunc(ctx expr.EvalContext, vals ...value.Value) (value.BoolValue, bool) {
for _, v := range vals {
if v.Err() || v.Nil() {
return value.NewBoolValue(false), true
} else if value.IsNilIsh(v.Rv()) {
return value.NewBoolValue(false), true
}
if nv, ok := v.(value.NumericValue); ok {
if iv := nv.Int(); iv < 0 {
return value.NewBoolValue(false), true
}
continue
}
switch vt := v.(type) {
case value.TimeValue:
if vt.Val().IsZero() {
return value.NewBoolValue(false), true
}
case value.BoolValue:
if vt.Val() == false {
return value.NewBoolValue(false), true
}
}
}
return value.NewBoolValue(true), true
}
开发者ID:kyledj,项目名称:qlbridge,代码行数:38,代码来源:builtins.go
示例15: walkUnary
func walkUnary(ctx expr.EvalContext, node *expr.UnaryNode) (value.Value, bool) {
a, ok := Eval(ctx, node.Arg)
if !ok {
switch node.Operator.T {
case lex.TokenExists:
return value.NewBoolValue(false), true
case lex.TokenNegate:
return value.NewBoolValue(true), true
}
u.Debugf("unary could not evaluate for[ %s ] and %#v", node.String(), node)
return a, false
}
switch node.Operator.T {
case lex.TokenNegate:
switch argVal := a.(type) {
case value.BoolValue:
//u.Debugf("found unary bool: res=%v expr=%v", !argVal.Val(), node)
return value.NewBoolValue(!argVal.Val()), true
case nil, value.NilValue:
return value.NewBoolValue(false), false
default:
u.LogThrottle(u.WARN, 5, "unary type not implemented. Unknonwn node type: %T:%v node=%s", argVal, argVal, node.String())
return value.NewNilValue(), false
}
case lex.TokenMinus:
if an, aok := a.(value.NumericValue); aok {
return value.NewNumberValue(-an.Float()), true
}
case lex.TokenExists:
switch a.(type) {
case nil, value.NilValue:
return value.NewBoolValue(false), true
}
if a.Nil() {
return value.NewBoolValue(false), true
}
return value.NewBoolValue(true), true
default:
u.Warnf("urnary not implemented for type %s %#v", node.Operator.T.String(), node)
}
return value.NewNilValue(), false
}
开发者ID:allisonmorgan,项目名称:qlbridge,代码行数:45,代码来源:vm.go
示例16: parseUpdateList
func (m *Sqlbridge) parseUpdateList() (map[string]*ValueColumn, error) {
cols := make(map[string]*ValueColumn)
lastColName := ""
for {
//u.Debugf("col:%v cur:%v", lastColName, m.Cur().String())
switch m.Cur().T {
case lex.TokenWhere, lex.TokenLimit, lex.TokenEOS, lex.TokenEOF:
return cols, nil
case lex.TokenValue:
cols[lastColName] = &ValueColumn{Value: value.NewStringValue(m.Cur().V)}
case lex.TokenInteger:
iv, _ := strconv.ParseInt(m.Cur().V, 10, 64)
cols[lastColName] = &ValueColumn{Value: value.NewIntValue(iv)}
case lex.TokenComma, lex.TokenEqual:
// don't need to do anything
case lex.TokenIdentity:
// TODO: this is a bug in lexer
lv := m.Cur().V
if bv, err := strconv.ParseBool(lv); err == nil {
cols[lastColName] = &ValueColumn{Value: value.NewBoolValue(bv)}
} else {
lastColName = m.Cur().V
}
case lex.TokenUdfExpr:
tree := expr.NewTreeFuncs(m.SqlTokenPager, m.funcs)
if err := m.parseNode(tree); err != nil {
u.Errorf("could not parse: %v", err)
return nil, err
}
cols[lastColName] = &ValueColumn{Expr: tree.Root}
default:
u.Warnf("don't know how to handle ? %v", m.Cur())
return nil, fmt.Errorf("expected column but got: %v", m.Cur().String())
}
m.Next()
}
panic("unreachable")
}
开发者ID:allisonmorgan,项目名称:qlbridge,代码行数:40,代码来源:parse_sql.go
示例17: parseValueList
func (m *Sqlbridge) parseValueList() ([][]*ValueColumn, error) {
if m.Cur().T != lex.TokenLeftParenthesis {
return nil, fmt.Errorf("Expecting opening paren ( but got %v", m.Cur())
}
var row []*ValueColumn
values := make([][]*ValueColumn, 0)
for {
//u.Debug(m.Cur().String())
switch m.Cur().T {
case lex.TokenLeftParenthesis:
// start of row
if len(row) > 0 {
values = append(values, row)
}
row = make([]*ValueColumn, 0)
case lex.TokenRightParenthesis:
values = append(values, row)
case lex.TokenFrom, lex.TokenInto, lex.TokenLimit, lex.TokenEOS, lex.TokenEOF:
if len(row) > 0 {
values = append(values, row)
}
return values, nil
case lex.TokenValue:
row = append(row, &ValueColumn{Value: value.NewStringValue(m.Cur().V)})
case lex.TokenInteger:
iv, err := strconv.ParseInt(m.Cur().V, 10, 64)
if err != nil {
return nil, err
}
row = append(row, &ValueColumn{Value: value.NewIntValue(iv)})
case lex.TokenFloat:
fv, err := strconv.ParseFloat(m.Cur().V, 64)
if err != nil {
return nil, err
}
row = append(row, &ValueColumn{Value: value.NewNumberValue(fv)})
case lex.TokenBool:
bv, err := strconv.ParseBool(m.Cur().V)
if err != nil {
return nil, err
}
row = append(row, &ValueColumn{Value: value.NewBoolValue(bv)})
case lex.TokenIdentity:
// TODO: this is a bug in lexer
lv := m.Cur().V
if bv, err := strconv.ParseBool(lv); err == nil {
row = append(row, &ValueColumn{Value: value.NewBoolValue(bv)})
} else {
// error?
u.Warnf("Could not figure out how to use: %v", m.Cur())
}
case lex.TokenLeftBracket:
// an array of values?
m.Next() // Consume the [
arrayVal, err := expr.ValueArray(m.SqlTokenPager)
if err != nil {
return nil, err
}
//n := NewValueNode(arrayVal)
row = append(row, &ValueColumn{Value: arrayVal})
u.Infof("what is token? %v peek:%v", m.Cur(), m.Peek())
//t.Next()
case lex.TokenComma:
// don't need to do anything
case lex.TokenUdfExpr:
tree := expr.NewTreeFuncs(m.SqlTokenPager, m.funcs)
if err := m.parseNode(tree); err != nil {
u.Errorf("could not parse: %v", err)
return nil, err
}
//col.Expr = tree.Root
row = append(row, &ValueColumn{Expr: tree.Root})
default:
u.Warnf("don't know how to handle ? %v", m.Cur())
return nil, fmt.Errorf("expected column but got: %v", m.Cur().String())
}
m.Next()
}
panic("unreachable")
}
开发者ID:allisonmorgan,项目名称:qlbridge,代码行数:84,代码来源:parse_sql.go
示例18:
{`match("score_")`, value.NewMapValue(map[string]interface{}{"amount": "22"})},
{`match("score_","tag_")`, value.NewMapValue(map[string]interface{}{"amount": "22", "name": "bob"})},
{`match("nonfield_")`, value.ErrValue},
{`filter(match("score_","tag_"),"nam*")`, value.NewMapValue(map[string]interface{}{"amount": "22"})},
{`filter(match("score_","tag_"),"name")`, value.NewMapValue(map[string]interface{}{"amount": "22"})},
{`filter(split("apples,oranges",","),"ora*")`, value.NewStringsValue([]string{"apples"})},
{`filter(split("apples,oranges",","), ["ora*","notmatch","stuff"] )`, value.NewStringsValue([]string{"apples"})},
{`email("[email protected]")`, value.NewStringValue("[email protected]")},
{`email("Bob <bob>")`, value.ErrValue},
{`email("Bob <[email protected]>")`, value.NewStringValue("[email protected]")},
{`oneof(not_a_field, email("Bob <[email protected]>"))`, value.NewStringValue("[email protected]")},
{`oneof(email, email(not_a_field))`, value.NewStringValue("[email protected]")},
{`oneof(email, email(not_a_field)) NOT IN ("a","b",10, 4.5) `, value.NewBoolValue(true)},
{`oneof(email, email(not_a_field)) IN ("[email protected]","b",10, 4.5) `, value.NewBoolValue(true)},
{`oneof(email, email(not_a_field)) IN ("b",10, 4.5) `, value.NewBoolValue(false)},
{`emailname("Bob<[email protected]>")`, value.NewStringValue("Bob")},
{`emaildomain("Bob<[email protected]>")`, value.NewStringValue("gmail.com")},
{`map(event, 22)`, value.NewMapValue(map[string]interface{}{"hello": 22})},
{`map(event, toint(score_amount))`, value.NewMapValue(map[string]interface{}{"hello": 22})},
{`host("https://www.Google.com/search?q=golang")`, value.NewStringValue("www.google.com")},
{`host("www.Google.com/?q=golang")`, value.NewStringValue("www.google.com")},
//{`host("notvalid")`, value.NewStringValue("notvalid")},
{`hosts("www.Google.com/?q=golang", "www.golang.org/")`, value.NewStringsValue([]string{"www.google.com", "www.golang.org"})},
开发者ID:allisonmorgan,项目名称:qlbridge,代码行数:30,代码来源:builtins_test.go
示例19:
}
expr.FuncAdd("eq", Eq)
expr.FuncAdd("toint", ToInt)
expr.FuncAdd("yy", Yy)
}
var (
// This is the message context which will be added to all tests below
// and be available to the VM runtime for evaluation by using
// key's such as "int5" or "user_id"
msgContext = datasource.NewContextSimpleData(map[string]value.Value{
"int5": value.NewIntValue(5),
"str5": value.NewStringValue("5"),
"bvalt": value.NewBoolValue(true),
"bvalf": value.NewBoolValue(false),
"user_id": value.NewStringValue("abc"),
})
// list of tests
vmTests = []vmTest{
// Between: Tri Node Tests
vmt("tri between ints", `10 BETWEEN 1 AND 50`, true, noError),
vmt("tri between ints false", `10 BETWEEN 20 AND 50`, false, noError),
vmtall("tri between ints false", `10 BETWEEN 20 AND true`, nil, parseOk, evalError),
// In: Multi Arg Tests
vmtall("multi-arg: In (x,y,z) ", `10 IN ("a","b",10, 4.5)`, true, parseOk, evalError),
vmtall("multi-arg: In (x,y,z) ", `10 IN ("a","b",20, 4.5)`, false, parseOk, evalError),
vmtall("multi-arg: In (x,y,z) ", `"a" IN ("a","b",10, 4.5)`, true, parseOk, evalError),
开发者ID:schmichael,项目名称:qlbridge,代码行数:31,代码来源:vm_test.go
示例20:
{`all("Linux",true,not_a_realfield)`, value.BoolValueFalse},
{`all("Linux",false)`, value.BoolValueFalse},
{`all("Linux","")`, value.BoolValueFalse},
{`all("Linux",notreal)`, value.BoolValueFalse},
{`match("score_")`, value.NewMapValue(map[string]interface{}{"amount": "22"})},
{`match("score_","tag_")`, value.NewMapValue(map[string]interface{}{"amount": "22", "name": "bob"})},
{`match("nonfield_")`, value.ErrValue},
{`email("[email protected]")`, value.NewStringValue("[email protected]")},
{`email("Bob <bob>")`, value.ErrValue},
{`email("Bob <[email protected]>")`, value.NewStringValue("[email protected]")},
{`oneof(not_a_field, email("Bob <[email protected]>"))`, value.NewStringValue("[email protected]")},
{`oneof(email, email(not_a_field))`, value.NewStringValue("[email protected]")},
{`oneof(email, email(not_a_field)) NOT IN ("a","b",10, 4.5) `, value.NewBoolValue(true)},
{`oneof(email, email(not_a_field)) IN ("[email protected]","b",10, 4.5) `, value.NewBoolValue(true)},
{`oneof(email, email(not_a_field)) IN ("b",10, 4.5) `, value.NewBoolValue(false)},
{`emailname("Bob<[email protected]>")`, value.NewStringValue("Bob")},
{`emaildomain("Bob<[email protected]>")`, value.NewStringValue("gmail.com")},
{`map(event, 22)`, value.NewMapValue(map[string]interface{}{"hello": 22})},
{`map(event, toint(score_amount))`, value.NewMapValue(map[string]interface{}{"hello": 22})},
{`host("https://www.Google.com/search?q=golang")`, value.NewStringValue("www.google.com")},
{`host("www.Google.com/?q=golang")`, value.NewStringValue("www.google.com")},
//{`host("notvalid")`, value.NewStringValue("notvalid")},
{`urldecode("hello+world")`, value.NewStringValue("hello world")},
开发者ID:kyledj,项目名称:qlbridge,代码行数:31,代码来源:builtins_test.go
注:本文中的github.com/araddon/qlbridge/value.NewBoolValue函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论