Giter Club home page Giter Club logo

Comments (7)

caibirdme avatar caibirdme commented on June 14, 2024

因为我的yql_test.go也是package yql,是同一个包,因此可以使用包中的私有变量

from yql.

luciferofwg avatar luciferofwg commented on June 14, 2024

嗯,谢谢~
我在使用Match匹配规则时,传入的参数中包含有map,那么规则应该怎么写呢,我尝试的写了一下,似乎不是我预期的值,正在学习你的源码,限于刚接触不久的golang,水平着实有限,肯请指教~谢谢!以下是我添加的部分代码
rawYQL = score in (7,1,9,5,3) and hobby.key in ('soccer', 'swim') m := map[string]string{"key":"soccer"} result, _ = yql.Match(rawYQL, map[string]interface{}{ "score": []int64{3, 5, 1}, "hobby": m, }) fmt.Println(result)

from yql.

caibirdme avatar caibirdme commented on June 14, 2024

@luciferofwg 以上语法是不支持 hobby.key这种变量访问方式,目前只支持和sql一样直接引用变量名。你上面的例子应该改写为:

rawYQL = score in (7,1,9,5,3) and hobby_key in ('soccer', 'swim')
result, _ = yql.Match(rawYQL, map[string]interface{}{ "score": []int64{3, 5, 1}, "hobby_key": m["key"], })

from yql.

caibirdme avatar caibirdme commented on June 14, 2024

只有lambda表达式中才支持a.b这样的语法

from yql.

luciferofwg avatar luciferofwg commented on June 14, 2024

只有lambda表达式中才支持a.b这样的语法

嗯,谢谢版主~

from yql.

sdghchj avatar sdghchj commented on June 14, 2024

@luciferofwg 以上语法是不支持 hobby.key这种变量访问方式,目前只支持和sql一样直接引用变量名。你上面的例子应该改写为:

rawYQL = score in (7,1,9,5,3) and hobby_key in ('soccer', 'swim')
result, _ = yql.Match(rawYQL, map[string]interface{}{ "score": []int64{3, 5, 1}, "hobby_key": m["key"], })

不支持?
4 Jun 2018: #1 (comment)
到底支持还是不支持?

from yql.

caibirdme avatar caibirdme commented on June 14, 2024

@sdghchj YQL有两部分,一部分是sql,这部分不支持nested object。另一部分是lambda,这部分是支持的

from yql.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.