diff options
author | Etienne Perot <eperot@google.com> | 2021-09-22 17:12:57 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-09-22 17:15:02 -0700 |
commit | 6b7f58b2ac084088c8ef37ce041262be710404b1 (patch) | |
tree | 719efe0a580088c8059a585284c18ec547f43516 /tools/bigquery/bigquery.go | |
parent | 586f147cd6f0324328a318324049b2b54e3e7bcd (diff) |
Add `NewCondition` helper in `bigquery.go`.
PiperOrigin-RevId: 398366805
Diffstat (limited to 'tools/bigquery/bigquery.go')
-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) } |