MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / ParseBytes

Function ParseBytes

schema/parse.go:26–40  ·  view source on GitHub ↗

ParseBytes parses the byte array which holds the schema. We will reset all the globals. Overwrites schema blindly - called only during initilization in testing

(s []byte, gid uint32)

Source from the content-addressed store, hash-verified

24// all the globals.
25// Overwrites schema blindly - called only during initilization in testing
26func ParseBytes(s []byte, gid uint32) (rerr error) {
27 if pstate == nil {
28 reset()
29 }
30 pstate.DeleteAll()
31 result, err := Parse(string(s))
32 if err != nil {
33 return err
34 }
35
36 for _, update := range result.Preds {
37 State().Set(update.Predicate, update)
38 }
39 return nil
40}
41
42func parseDirective(it *lex.ItemIterator, schema *pb.SchemaUpdate, t types.TypeID) error {
43 it.Next()

Calls 5

resetFunction · 0.85
DeleteAllMethod · 0.80
ParseFunction · 0.70
StateFunction · 0.70
SetMethod · 0.65

Tested by 15

benchmarkParsingHelperFunction · 0.74
TestDeletePredicateFunction · 0.74
TestMutationSingleUidFunction · 0.74
TestJsonMutationFunction · 0.74