diff --git a/psql/columns.go b/psql/columns.go index fa4027f..c1b3c83 100644 --- a/psql/columns.go +++ b/psql/columns.go @@ -3,6 +3,7 @@ package psql import ( "errors" + "fmt" "io" "strings" @@ -35,8 +36,6 @@ func (c *compilerContext) renderBaseColumns( c.renderComma(i) realColsRendered = append(realColsRendered, n) colWithTable(c.w, ti.Name, cn) - i++ - continue } else { switch { @@ -44,27 +43,31 @@ func (c *compilerContext) renderBaseColumns( if err := c.renderColumnSearchRank(sel, ti, col, i); err != nil { return nil, false, err } - i++ case isSearch && strings.HasPrefix(cn, "search_headline_"): if err := c.renderColumnSearchHeadline(sel, ti, col, i); err != nil { return nil, false, err } - i++ case cn == "__typename": if err := c.renderColumnTypename(sel, ti, col, i); err != nil { return nil, false, err } - i++ + + case strings.HasSuffix(cn, "_cursor"): + continue + default: if err := c.renderColumnFunction(sel, ti, col, i); err != nil { return nil, false, err } + fmt.Println(">>>> isAgg", cn, sel.Name) + isAgg = true - i++ } } + i++ + } if isCursorPaged { diff --git a/psql/query.go b/psql/query.go index 24983fc..e8bc735 100644 --- a/psql/query.go +++ b/psql/query.go @@ -516,6 +516,10 @@ func (c *compilerContext) renderColumns(sel *qcode.Select, ti *DBTableInfo, skip cn = col.Name[n:] } else { cn = col.Name + + if strings.HasSuffix(cn, "_cursor") { + continue + } } if len(sel.Allowed) != 0 { diff --git a/qcode/parse.go b/qcode/parse.go index 581bebc..25ebcad 100644 --- a/qcode/parse.go +++ b/qcode/parse.go @@ -339,6 +339,13 @@ func (p *Parser) parseFields(fields []Field) ([]Field, error) { if p.peek(itemObjOpen) { p.ignore() st.Push(f.ID) + + } else if p.peek(itemObjClose) { + if st.Len() == 0 { + break + } else { + continue + } } }