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

Function parseGqlSchema

dgraph/cmd/bulk/loader.go:447–463  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

445}
446
447func parseGqlSchema(s string) map[uint64]string {
448 var schemas []x.ExportedGQLSchema
449 if err := json.Unmarshal([]byte(s), &schemas); err != nil {
450 fmt.Println("Error while decoding the graphql schema. Assuming it to be in format < 21.03.")
451 return map[uint64]string{x.RootNamespace: s}
452 }
453
454 schemaMap := make(map[uint64]string)
455 for _, schema := range schemas {
456 if _, ok := schemaMap[schema.Namespace]; ok {
457 fmt.Printf("Found multiple GraphQL schema for namespace %d.", schema.Namespace)
458 continue
459 }
460 schemaMap[schema.Namespace] = schema.Schema
461 }
462 return schemaMap
463}
464
465func readGqlSchema(opt *BulkOptions) []byte {
466 f, err := filestore.Open(opt.GqlSchemaFile)

Callers 2

genDQLSchemaFunction · 0.85
processGqlSchemaMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected