From 63e516b63f27e8d494542ffd841d558e268b811c Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Mon, 14 Nov 2016 13:22:43 +0000 Subject: [PATCH] Add method for parsing json object directly --- sql/exprs.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sql/exprs.go b/sql/exprs.go index feaa8e62..f2b85914 100644 --- a/sql/exprs.go +++ b/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) { _, lit, err := p.shouldBe(NUMBER)