MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / parseNullsClause

Method parseNullsClause

pkg/sql/parser/window.go:558–574  ·  view source on GitHub ↗

parseNullsClause parses the optional NULLS FIRST/LAST clause in ORDER BY expressions. Returns a pointer to bool indicating null ordering: true for NULLS FIRST, false for NULLS LAST, nil if not specified.

()

Source from the content-addressed store, hash-verified

556// parseNullsClause parses the optional NULLS FIRST/LAST clause in ORDER BY expressions.
557// Returns a pointer to bool indicating null ordering: true for NULLS FIRST, false for NULLS LAST, nil if not specified.
558func (p *Parser) parseNullsClause() (*bool, error) {
559 if p.isType(models.TokenTypeNulls) {
560 p.advance() // Consume NULLS
561 if p.isType(models.TokenTypeFirst) {
562 t := true
563 p.advance() // Consume FIRST
564 return &t, nil
565 } else if p.isType(models.TokenTypeLast) {
566 f := false
567 p.advance() // Consume LAST
568 return &f, nil
569 } else {
570 return nil, p.expectedError("FIRST or LAST after NULLS")
571 }
572 }
573 return nil, nil
574}
575
576// parseGroupingExpressionList parses a parenthesized, comma-separated list of expressions

Callers 3

parseFunctionCallMethod · 0.95
parseWindowSpecMethod · 0.95
parseOrderByClauseMethod · 0.95

Calls 3

isTypeMethod · 0.95
advanceMethod · 0.95
expectedErrorMethod · 0.95

Tested by

no test coverage detected