예제 #1
0
func executeQuery(user common.User, database, query string, db datastore.Datastore, c *C) []*protocol.Series {
	q, errQ := parser.ParseSelectQuery(query)
	c.Assert(errQ, IsNil)
	resultSeries := []*protocol.Series{}
	yield := func(series *protocol.Series) error {
		// ignore time series which have no data, this includes
		// end of series indicator
		if len(series.Points) > 0 {
			resultSeries = append(resultSeries, series)
		}
		return nil
	}
	err := db.ExecuteQuery(user, database, q, yield, nil)
	c.Assert(err, IsNil)
	return resultSeries
}
예제 #2
0
func cleanDb(db datastore.Datastore) {
	if db != nil {
		db.Close()
	}
	os.RemoveAll(DB_DIR)
}