Query extracts data specified by the query from the msgpack stream skipping any other data. Query consists of map keys and array indexes separated with dot, e.g. key1.0.key2.
(query string)
| 30 | // any other data. Query consists of map keys and array indexes separated with dot, |
| 31 | // e.g. key1.0.key2. |
| 32 | func (d *Decoder) Query(query string) ([]interface{}, error) { |
| 33 | res := queryResult{ |
| 34 | query: query, |
| 35 | } |
| 36 | if err := d.query(&res); err != nil { |
| 37 | return nil, err |
| 38 | } |
| 39 | return res.values, nil |
| 40 | } |
| 41 | |
| 42 | func (d *Decoder) query(q *queryResult) error { |
| 43 | q.nextKey() |