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

Function initialTypesInternal

schema/schema.go:654–753  ·  view source on GitHub ↗

NOTE: whenever defining a new type here, please also add it in x/keys.go: preDefinedTypeMap

(namespace uint64, all bool)

Source from the content-addressed store, hash-verified

652
653// NOTE: whenever defining a new type here, please also add it in x/keys.go: preDefinedTypeMap
654func initialTypesInternal(namespace uint64, all bool) []*pb.TypeUpdate {
655 var initialTypes []*pb.TypeUpdate
656 initialTypes = append(initialTypes,
657 &pb.TypeUpdate{
658 TypeName: "dgraph.graphql",
659 Fields: []*pb.SchemaUpdate{
660 {
661 Predicate: "dgraph.graphql.schema",
662 ValueType: pb.Posting_STRING,
663 },
664 {
665 Predicate: "dgraph.graphql.xid",
666 ValueType: pb.Posting_STRING,
667 },
668 },
669 },
670 &pb.TypeUpdate{
671 TypeName: "dgraph.graphql.persisted_query",
672 Fields: []*pb.SchemaUpdate{
673 {
674 Predicate: "dgraph.graphql.p_query",
675 ValueType: pb.Posting_STRING,
676 },
677 },
678 })
679
680 if namespace == x.RootNamespace {
681 initialTypes = append(initialTypes,
682 &pb.TypeUpdate{
683 TypeName: "dgraph.namespace",
684 Fields: []*pb.SchemaUpdate{
685 {
686 Predicate: "dgraph.namespace.name",
687 ValueType: pb.Posting_STRING,
688 },
689 {
690 Predicate: "dgraph.namespace.id",
691 ValueType: pb.Posting_INT,
692 },
693 },
694 })
695 }
696
697 if all || x.WorkerConfig.AclEnabled {
698 // These type definitions are required for deleteUser and deleteGroup GraphQL API to work
699 // properly.
700 initialTypes = append(initialTypes,
701 &pb.TypeUpdate{
702 TypeName: "dgraph.type.User",
703 Fields: []*pb.SchemaUpdate{
704 {
705 Predicate: "dgraph.xid",
706 ValueType: pb.Posting_STRING,
707 },
708 {
709 Predicate: "dgraph.password",
710 ValueType: pb.Posting_PASSWORD,
711 },

Callers 2

InitialTypesFunction · 0.85
CompleteInitialTypesFunction · 0.85

Calls 1

NamespaceAttrFunction · 0.92

Tested by

no test coverage detected