Add aggregrate functions to GQL queries

This commit is contained in:
Vikram Rangnekar
2019-03-31 11:18:33 -04:00
parent 4cebe9cfb0
commit 89d435640b
4 changed files with 167 additions and 50 deletions

View File

@ -284,18 +284,20 @@ func (com *Compiler) compileQuery(op *Operation) (*Query, error) {
for i := range field.Children {
f := field.Children[i]
fn := strings.ToLower(f.Name)
if com.bl != nil && com.bl.MatchString(f.Name) {
if com.bl != nil && com.bl.MatchString(fn) {
continue
}
if f.Children == nil {
col := &Column{Name: f.Name}
col := &Column{Name: fn}
if len(f.Alias) != 0 {
col.FieldName = f.Alias
} else {
col.FieldName = f.Name
}
s.Cols = append(s.Cols, col)
} else {
st.Push(f)