コード例 #1
0
ファイル: postgres.go プロジェクト: tgres/tgres
func (p *pgSerDe) SeriesQuery(ds *rrd.DataSource, from, to time.Time, maxPoints int64) (dsl.Series, error) {

	rra := ds.BestRRA(from, to, maxPoints)

	// If from/to are nil - assign the rra boundaries
	rraEarliest := rra.Begins(rra.Latest())

	if from.IsZero() || rraEarliest.After(from) {
		from = rraEarliest
	}

	// Note that seriesQuerySqlUsingViewAndSeries() will modify "to"
	// to be the earliest of "to" or "LastUpdate".
	dps := &dbSeries{db: p, ds: ds, rra: rra, from: from, to: to, maxPoints: maxPoints}
	return dsl.Series(dps), nil
}