MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / parseVarName

Function parseVarName

dql/parser.go:898–920  ·  view source on GitHub ↗

parseVarName returns the variable name.

(it *lex.ItemIterator)

Source from the content-addressed store, hash-verified

896
897// parseVarName returns the variable name.
898func parseVarName(it *lex.ItemIterator) (string, error) {
899 val := "$"
900 var consumeAtLeast bool
901 for {
902 items, err := it.Peek(1)
903 if err != nil {
904 return val, err
905 }
906 if items[0].Typ != itemName {
907 if !consumeAtLeast {
908 return "", it.Errorf("Expected variable name after $")
909 }
910 break
911 }
912 consumeAtLeast = true
913 val += items[0].Val
914 // Consume the current item.
915 if !it.Next() {
916 break
917 }
918 }
919 return val, nil
920}
921
922func parseRecurseArgs(it *lex.ItemIterator, gq *GraphQuery) error {
923 if ok := trySkipItemTyp(it, itemLeftRound); !ok {

Callers 3

parseRecurseArgsFunction · 0.85
parseFunctionFunction · 0.85
parseMathFuncFunction · 0.85

Calls 3

PeekMethod · 0.45
ErrorfMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…