Skip to content

Commit

Permalink
don't complain about missing tags
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrake committed Sep 26, 2018
1 parent 2fd8b01 commit ca69206
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 0 additions & 6 deletions decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ func decode(columns []string, values [][]interface{}, result interface{}) error
// Accumulate any errors
errs := make([]string, 0)

missingTagError := false
typeError := false

for _, vIn := range values {
Expand All @@ -77,11 +76,6 @@ func decode(columns []string, values [][]interface{}, result interface{}) error
i, ok := colIndex[tag]

if !ok {
if !missingTagError {
err := fmt.Errorf("Missing tag: %v", tag)
errs = appendErrors(errs, err)
missingTagError = true
}
continue
}

Expand Down
6 changes: 5 additions & 1 deletion examples/writeread.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ type envSample struct {
ID string `influx:"-"`
}

// we populate a few more fields when reading back
// date to verify unused fields are handled correctly
type envSampleRead struct {
Time time.Time `influx:"time"`
Location string `influx:"location,tag"`
City string `influx:"city,tag"`
Temperature float64 `influx:"temperature"`
Humidity float64 `influx:"humidity"`
Cycles float64 `influx:"cycles"`
ID string `influx:"-"`
}

Expand Down Expand Up @@ -83,7 +87,7 @@ func main() {
}

// query data from db
samplesRead := []envSample{}
samplesRead := []envSampleRead{}

q := `SELECT * FROM test ORDER BY time DESC LIMIT 10`
err = c.Query(db, q, &samplesRead)
Expand Down

0 comments on commit ca69206

Please sign in to comment.