Skip to content

Commit a730a44

Browse files
author
ultd
committed
fixed fields bug
1 parent 9298608 commit a730a44

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

model.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -391,12 +391,7 @@ func (m *Model) buildColumns() string {
391391
}
392392
}
393393

394-
out := ""
395-
n := 0
396-
// decrement one from n counter if designated field is not nil
397-
if m.designatedTS != nil {
398-
n = 1
399-
}
394+
fieldsSerialized := []string{}
400395
for _, field := range fields {
401396
// skip including this in columns field as it will be included in the timestamp section of
402397
// line message:
@@ -405,14 +400,10 @@ func (m *Model) buildColumns() string {
405400
if field.tagOptions.designatedTS {
406401
continue
407402
}
408-
out += fmt.Sprintf("%s=%s", field.qdbName, field.valueSerialized)
409-
if n != len(fields)-1 {
410-
out += ","
411-
}
412-
n++
403+
fieldsSerialized = append(fieldsSerialized, fmt.Sprintf("%s=%s", field.qdbName, field.valueSerialized))
413404
}
414405

415-
return out
406+
return strings.Join(fieldsSerialized, ",")
416407
}
417408

418409
func (m *Model) buildTimestamp() string {

0 commit comments

Comments
 (0)