sq/libsq/ast/unique.go
Neil O'Toole 29e33ed2b1
Implement unique / DISTINCT ()
- Implemented "unique" function
- Implemented "count_unique" function
2023-03-28 00:48:24 -06:00

22 lines
508 B
Go

package ast
import "github.com/neilotoole/sq/libsq/ast/internal/slq"
// UniqueNode implements the SQL "DISTINCT" clause.
type UniqueNode struct {
baseNode
}
// String returns a log/debug-friendly representation.
func (n *UniqueNode) String() string {
return nodeString(n)
}
// VisitUniqueFunc implements slq.SLQVisitor.
func (v *parseTreeVisitor) VisitUniqueFunc(ctx *slq.UniqueFuncContext) interface{} {
node := &UniqueNode{}
node.ctx = ctx
node.text = ctx.GetText()
return v.cur.AddChild(node)
}