diff options
-rw-r--r-- | tools/bigquery/bigquery.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/bigquery/bigquery.go b/tools/bigquery/bigquery.go index 082410697..2e401b630 100644 --- a/tools/bigquery/bigquery.go +++ b/tools/bigquery/bigquery.go @@ -107,10 +107,7 @@ func (bm *Benchmark) AddMetric(metricName, unit string, sample float64) { // AddCondition adds a condition to an existing Benchmark. func (bm *Benchmark) AddCondition(name, value string) { - bm.Condition = append(bm.Condition, &Condition{ - Name: name, - Value: value, - }) + bm.Condition = append(bm.Condition, NewCondition(name, value)) } // NewBenchmark initializes a new benchmark. @@ -136,6 +133,14 @@ type Condition struct { Value string `bq:"value"` } +// NewCondition returns a new Condition with the given name and value. +func NewCondition(name, value string) *Condition { + return &Condition{ + Name: name, + Value: value, + } +} + func (c *Condition) String() string { return fmt.Sprintf("Condition:\nName: %s Value: %s\n", c.Name, c.Value) } |