Execute bounds data into template and writes the result.
(wr io.Writer, data interface{})
| 64 | |
| 65 | // Execute bounds data into template and writes the result. |
| 66 | func (j *JSONPath) Execute(wr io.Writer, data interface{}) error { |
| 67 | fullResults, err := j.FindResults(data) |
| 68 | if err != nil { |
| 69 | return err |
| 70 | } |
| 71 | for ix := range fullResults { |
| 72 | if err := j.PrintResults(wr, fullResults[ix]); err != nil { |
| 73 | return err |
| 74 | } |
| 75 | } |
| 76 | return nil |
| 77 | } |
| 78 | |
| 79 | func (j *JSONPath) FindResults(data interface{}) ([][]reflect.Value, error) { |
| 80 | if j.parser == nil { |