Documentation ¶
Index ¶
- Variables
- type SimpleQueryBuilder
- type Stats
- func (s *Stats) SimpleCount(ctx context.Context, counterKey string) (int, error)
- func (s *Stats) SimpleGroupBy(ctx context.Context, groupByKey string, counterKey string) ([]stats.Group, error)
- func (s *Stats) SimpleGroupByOverTime(ctx context.Context, from, to time.Time, timeRange string, ...) ([]stats.TimeSeries, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var DateMongoFormat = map[string]string{
"hour": "%Y-%m-%d %H",
"day": "%Y-%m-%d",
"month": "%Y-%m",
"week": "%V",
"year": "%Y",
}
View Source
var DateTimeFormat = map[string]string{
"hour": "2006-01-02 15",
"day": "2006-01-02",
"month": "2006-01",
"week": "",
"year": "2006",
}
Functions ¶
This section is empty.
Types ¶
type SimpleQueryBuilder ¶
type SimpleQueryBuilder struct {
// contains filtered or unexported fields
}
SimpleQueryBuilder is a simple MongoDB query builder.
func (*SimpleQueryBuilder) Build ¶
func (q *SimpleQueryBuilder) Build() bson.M
Build returns the result of the query builder as a bson.M. If Build() is called on a nil value it returns an empty bson.M that would match all documents.
func (*SimpleQueryBuilder) Where ¶
func (q *SimpleQueryBuilder) Where(key string, operator string, value interface{}) *SimpleQueryBuilder
Where matches MongoDB documents where key matches value using operator. If Where overwrites any other "where clause" that used the same key and operator.
func (*SimpleQueryBuilder) WhereIn ¶
func (q *SimpleQueryBuilder) WhereIn(key string, value interface{}) *SimpleQueryBuilder
WhereIn searches from MongoDB documents where the value of key is in a list of values. WhereIn addes value to this list of queried values.
type Stats ¶
type Stats struct { ValidGroupBys map[string]bson.M ValidTimeKeys map[string]struct{} ValidCounts map[string]bson.M Collection *mongo.Collection }
func (*Stats) SimpleCount ¶
func (*Stats) SimpleGroupBy ¶
Click to show internal directories.
Click to hide internal directories.