Skip to content
Permalink
Browse files

add Bool function to get bool rep of value

  • Loading branch information...
cbrake committed Jun 14, 2019
1 parent 3a57dda commit 1f184c93186907735f546b5a6747d64f686c424c
Showing with 8 additions and 0 deletions.
  1. +8 −0 data/sample.go
@@ -27,6 +27,14 @@ type Sample struct {
Attributes map[string]float64 `json:"attributes,omitempty"`
}

// Bool returns a bool representation of value
func (s *Sample) Bool() bool {
if s.Value == 0 {
return false
}
return true
}

// NewSample creates a new sample at current time
func NewSample(ID, sampleType string, value float64) Sample {
return Sample{

0 comments on commit 1f184c9

Please sign in to comment.
You can’t perform that action at this time.