mirror of
https://github.com/neilotoole/sq.git
synced 2024-12-19 22:21:56 +03:00
9746f4c1a2
* wip: orderby impl * Tests passing (note: ast.checkASTIntegrity is disabled) * ExprNode now rendered via renderSelectorNode * linting * CHAGELOG for v0.27.0
38 lines
750 B
Go
38 lines
750 B
Go
package ast
|
|
|
|
import "github.com/neilotoole/sq/libsq/ast/internal/slq"
|
|
|
|
// RowRangeNode models a range, effectively {OFFSET,LIMIT}.
|
|
type RowRangeNode struct {
|
|
baseNode
|
|
Offset int
|
|
Limit int
|
|
}
|
|
|
|
func newRowRangeNode(ctx *slq.RowRangeContext, offset, limit int) *RowRangeNode {
|
|
rr := &RowRangeNode{}
|
|
rr.ctx = ctx
|
|
rr.Offset = offset
|
|
rr.Limit = limit
|
|
return rr
|
|
}
|
|
|
|
func (rr *RowRangeNode) String() string {
|
|
return rr.Text()
|
|
}
|
|
|
|
func (rr *RowRangeNode) Range() (offset, limit int) {
|
|
offset = rr.Offset
|
|
limit = rr.Limit
|
|
return offset, limit
|
|
}
|
|
|
|
func (rr *RowRangeNode) SetParent(parent Node) error {
|
|
seg, ok := parent.(*SegmentNode)
|
|
if !ok {
|
|
return errorf("%T requires parent of type *%s", rr, typeSegmentNode)
|
|
}
|
|
rr.parent = seg
|
|
return nil
|
|
}
|