Skip to content

Commit 6c01fbd

Browse files
committedJun 14, 2019
chore: add travis ci config and update readme
1 parent d313c0c commit 6c01fbd

File tree

3 files changed

+26
-11
lines changed

3 files changed

+26
-11
lines changed
 

‎.travis.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
language: go
2+
3+
go:
4+
- 1.12.x
5+
- tip
6+
7+
before_install:
8+
- go get -t -v ./...
9+
10+
script:
11+
- go test -race -coverprofile=coverage.txt -covermode=atomic
12+
13+
after_success:
14+
- bash <(curl -s https://codecov.io/bash)

‎README.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
#Kendo data query
2-
Does not support multiple sort
3-
Only supports `and` filter conditions
1+
# Kendo data query for Go
2+
3+
[![GoDoc](https://godoc.org/github.com/XavierTS/kendo-data-query?status.svg)](https://godoc.org/github.com/XavierTS/kendo-data-query)
4+
5+
## Limitations
6+
7+
* Does not support multiple sortss
8+
* Only supports `and` filter conditions

‎apply.go

+4-8
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,8 @@ func (d *DataState) getTotal(collection mgo.Collection) (total int, err error) {
102102
})
103103
}
104104

105-
//test
106-
data := []interface{}{}
107-
collection.Pipe(pipeline).All(&data)
105+
data := []interface{}{} // TODO wrong data type
106+
err = collection.Pipe(pipeline).All(&data)
108107
} else {
109108
total, err = collection.Find(filter).Count()
110109
}
@@ -152,8 +151,6 @@ func (d *DataState) getAggregate() (aggregate []bson.M) {
152151
ids[key] = fmt.Sprintf("$_id.%s", key)
153152
}
154153

155-
aggregate = append(aggregate, d.getFirstGrouping())
156-
157154
nbGroups := len(d.Group) - 1
158155
for i := nbGroups; i >= 0; i-- {
159156
group := d.Group[i]
@@ -214,12 +211,11 @@ func (d *DataState) addAggregates(m bson.M, firstlevel bool) bson.M {
214211
aggregates := bson.M{}
215212

216213
for _, a := range d.Aggregates {
217-
aggregateKey := fmt.Sprintf("$%s", d.toMongoAggregate(a.Aggregate))
214+
key := a.getKey()
218215
aggregate := bson.M{
219-
aggregateKey: getAggregateExpression(a, firstlevel),
216+
fmt.Sprintf("$%s", d.toMongoAggregate(a.Aggregate)): getAggregateExpression(a, firstlevel),
220217
}
221218

222-
key := a.getKey()
223219
if agg, ok := aggregates[key]; ok {
224220
m, _ := agg.(bson.M)
225221
m[a.Aggregate] = aggregate

0 commit comments

Comments
 (0)
Please sign in to comment.