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

Method parseVariantFieldName

pkg/sql/parser/expressions.go:458–472  ·  view source on GitHub ↗

parseVariantFieldName consumes one VARIANT path field name, which may be a bare identifier or a double-quoted string. Returns the name and advances past it.

()

Source from the content-addressed store, hash-verified

456// a bare identifier or a double-quoted string. Returns the name and
457// advances past it.
458func (p *Parser) parseVariantFieldName() (string, error) {
459 tok := p.currentToken.Token
460 switch {
461 case p.isIdentifier(), p.isType(models.TokenTypeDoubleQuotedString):
462 name := tok.Value
463 p.advance()
464 return name, nil
465 case p.isType(models.TokenTypeKeyword):
466 // Keywords may appear as field names (e.g. TYPE, VALUE, STATUS).
467 name := tok.Value
468 p.advance()
469 return name, nil
470 }
471 return "", p.expectedError("field name after `:` or `.`")
472}

Callers 1

Calls 4

isIdentifierMethod · 0.95
isTypeMethod · 0.95
advanceMethod · 0.95
expectedErrorMethod · 0.95

Tested by

no test coverage detected