MCPcopy Create free account
hub / github.com/araddon/qlbridge / parseFirstFilters

Method parseFirstFilters

rel/parse_filterql.go:413–444  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

411}
412
413func (m *FilterQLParser) parseFirstFilters() (expr.Node, error) {
414
415 // We have 2 special cases in filterQL
416 // FILTER *
417 // FILTER match_all
418 switch m.Cur().T {
419 case lex.TokenStar, lex.TokenMultiply:
420
421 m.Next() // Consume *
422 n := expr.NewIdentityNodeVal("*")
423 // if we have match all, nothing else allowed
424 return n, nil
425
426 case lex.TokenIdentity:
427 if strings.ToLower(m.Cur().V) == "match_all" {
428 m.Next()
429 n := expr.NewIdentityNodeVal("match_all")
430 // if we have match all, nothing else allowed
431 return n, nil
432 }
433 }
434
435 m.discardCommentsNewLines()
436
437 n, err := expr.ParseExprWithFuncs(m.filterTokenPager, m.funcs)
438 if err != nil {
439 u.Errorf("could not parse: %v", err)
440 return nil, err
441 }
442
443 return n, nil
444}
445
446func (m *FilterQLParser) parseLimit() (int, error) {
447 if m.Cur().T != lex.TokenLimit {

Callers 2

parseSelectMethod · 0.95
parseFilterMethod · 0.95

Calls 6

NewIdentityNodeValFunction · 0.92
ParseExprWithFuncsFunction · 0.92
ErrorfMethod · 0.80
CurMethod · 0.65
NextMethod · 0.65

Tested by

no test coverage detected