thedevsaddam / gojsonq

A simple Go package to Query over JSON/YAML/XML/CSV Data
https://github.com/thedevsaddam/gojsonq/wiki
MIT License
2.18k stars 140 forks source link

Add Out method issue #29 #30

Closed thedevsaddam closed 5 years ago

thedevsaddam commented 5 years ago

Usages Code of Out method:

package main

import (
    "github.com/davecgh/go-spew/spew"
    "github.com/thedevsaddam/gojsonq"
)

type item struct {
    ID    int     `json:"id"`
    Name  string  `json:"name"`
    Price float64 `json:"price"`
}

func main() {
    v := item{}
    jq := gojsonq.New().File("./data.json").From("items.[0]")
    jq.Out(&v)
    if jq.Error() != nil {
        panic(jq.Error())
    }
    spew.Dump(v)
}

// Output:
// (main.item) {
//  ID: (int) 1,
//  Name: (string) (len=26) "MacBook Pro 13 inch retina",
//  Price: (float64) 1350
// }
coveralls commented 5 years ago

Pull Request Test Coverage Report for Build 225


Totals Coverage Status
Change from base Build 222: 0.0%
Covered Lines: 878
Relevant Lines: 878

💛 - Coveralls
coveralls commented 5 years ago

Pull Request Test Coverage Report for Build 225


Totals Coverage Status
Change from base Build 222: 0.0%
Covered Lines: 878
Relevant Lines: 878

💛 - Coveralls