Implement transformNull
This commit is contained in:
@@ -14,6 +14,12 @@ func TransformOffset(offset float64) TransformFunc {
|
||||
}
|
||||
}
|
||||
|
||||
func TransformNull(nullValue float64) TransformFunc {
|
||||
return func(point TimePoint) TimePoint {
|
||||
return transformNull(point, nullValue)
|
||||
}
|
||||
}
|
||||
|
||||
func TransformShiftTime(interval time.Duration) TransformFunc {
|
||||
return func(point TimePoint) TimePoint {
|
||||
return transformShiftTime(point, interval)
|
||||
@@ -41,3 +47,10 @@ func transformShiftTime(point TimePoint, interval time.Duration) TimePoint {
|
||||
point.Time = shiftedTime
|
||||
return point
|
||||
}
|
||||
|
||||
func transformNull(point TimePoint, nullValue float64) TimePoint {
|
||||
if point.Value == nil {
|
||||
point.Value = &nullValue
|
||||
}
|
||||
return point
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user