Refactor: remove unused code

This commit is contained in:
Alexander Zobnin
2021-09-15 16:40:16 +03:00
parent 8fa10bb76b
commit 2f08ed13ff
2 changed files with 5 additions and 81 deletions

View File

@@ -28,6 +28,11 @@ func (tsd *TimeSeriesData) Add(point TimePoint) *TimeSeriesData {
return tsd
}
// Gets point timestamp rounded according to provided interval.
func (p *TimePoint) GetTimeFrame(interval time.Duration) time.Time {
return p.Time.Round(interval)
}
// GroupBy groups points in given interval by applying provided `aggFunc`. Source time series should be sorted by time.
func (ts TimeSeries) GroupBy(interval time.Duration, aggFunc AggFunc) TimeSeries {
if ts.Len() == 0 {
@@ -285,19 +290,6 @@ func findNearestLeft(series TimeSeries, pointIndex int) *TimePoint {
return nil
}
// Gets point timestamp rounded according to provided interval.
func (p *TimePoint) GetTimeFrame(interval time.Duration) time.Time {
return p.Time.Round(interval)
}
func getPointTimeFrame(ts *time.Time, interval time.Duration) *time.Time {
if ts == nil {
return nil
}
timeFrame := ts.Truncate(interval)
return &timeFrame
}
func getTimeFieldIndex(frame *data.Frame) int {
for i := 0; i < len(frame.Fields); i++ {
if frame.Fields[i].Type() == data.FieldTypeTime {