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

Function adminSchemaHandler

dgraph/cmd/alpha/http.go:667–700  ·  view source on GitHub ↗
(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

665}
666
667func adminSchemaHandler(w http.ResponseWriter, r *http.Request) {
668 if commonHandler(w, r) {
669 return
670 }
671
672 b := readRequest(w, r)
673 if b == nil {
674 return
675 }
676
677 gqlReq := &schema.Request{
678 Query: `
679 mutation updateGqlSchema($sch: String!) {
680 updateGQLSchema(input: {
681 set: {
682 schema: $sch
683 }
684 }) {
685 gqlSchema {
686 id
687 }
688 }
689 }`,
690 Variables: map[string]interface{}{"sch": string(b)},
691 }
692
693 response := resolveWithAdminServer(gqlReq, r, adminServer)
694 if len(response.Errors) > 0 {
695 x.SetStatus(w, x.Error, response.Errors.Error())
696 return
697 }
698
699 writeSuccessResponse(w, r)
700}
701
702func graphqlProbeHandler(gqlHealthStore *admin.GraphQLHealthStore, globalEpoch map[uint64]*uint64) http.Handler {
703 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 6

SetStatusFunction · 0.92
commonHandlerFunction · 0.85
readRequestFunction · 0.85
resolveWithAdminServerFunction · 0.85
writeSuccessResponseFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected