Add method for parsing json object directly
This commit is contained in:
parent
cd44c77de6
commit
63e516b63f
1 changed files with 13 additions and 0 deletions
13
sql/exprs.go
13
sql/exprs.go
|
@ -170,6 +170,19 @@ func (p *parser) parseArray() ([]interface{}, error) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *parser) parseObject() (exp map[string]interface{}, err error) {
|
||||||
|
|
||||||
|
_, lit, err := p.shouldBe(JSON)
|
||||||
|
if err != nil {
|
||||||
|
return nil, &ParseError{Found: lit, Expected: []string{"object"}}
|
||||||
|
}
|
||||||
|
|
||||||
|
val, err := p.declare(JSON, lit)
|
||||||
|
|
||||||
|
return val.(map[string]interface{}), err
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
func (p *parser) parseNumber() (int64, error) {
|
func (p *parser) parseNumber() (int64, error) {
|
||||||
|
|
||||||
_, lit, err := p.shouldBe(NUMBER)
|
_, lit, err := p.shouldBe(NUMBER)
|
||||||
|
|
Loading…
Reference in a new issue