MCPcopy
hub / github.com/dgraph-io/dgraph / isTypeDeclaration

Function isTypeDeclaration

schema/parse.go:608–626  ·  view source on GitHub ↗
(item lex.Item, it *lex.ItemIterator)

Source from the content-addressed store, hash-verified

606}
607
608func isTypeDeclaration(item lex.Item, it *lex.ItemIterator) bool {
609 if item.Val != "type" {
610 return false
611 }
612
613 nextItems, err := it.Peek(2)
614 switch {
615 case err != nil || len(nextItems) != 2:
616 return false
617
618 case nextItems[0].Typ != itemText:
619 return false
620
621 case nextItems[1].Typ != itemLeftCurl:
622 return false
623 }
624
625 return true
626}
627
628// parse parses a schema string and returns the schema representation for it.
629// If namespace == math.MaxUint64, then it preserves the namespace. Else it forces the passed

Callers 1

parseFunction · 0.85

Calls 1

PeekMethod · 0.45

Tested by

no test coverage detected