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

Function formatTypes

edgraph/server.go:2411–2428  ·  view source on GitHub ↗

formatTypes takes a list of TypeUpdates and converts them in to a list of maps in a format that is human-readable to be marshaled into JSON.

(typeList []*pb.TypeUpdate)

Source from the content-addressed store, hash-verified

2409// formatTypes takes a list of TypeUpdates and converts them in to a list of
2410// maps in a format that is human-readable to be marshaled into JSON.
2411func formatTypes(typeList []*pb.TypeUpdate) []map[string]interface{} {
2412 var res []map[string]interface{}
2413 for _, typ := range typeList {
2414 typeMap := make(map[string]interface{})
2415 typeMap["name"] = typ.TypeName
2416 fields := make([]map[string]string, len(typ.Fields))
2417
2418 for i, field := range typ.Fields {
2419 m := make(map[string]string, 1)
2420 m["name"] = field.Predicate
2421 fields[i] = m
2422 }
2423 typeMap["fields"] = fields
2424
2425 res = append(res, typeMap)
2426 }
2427 return res
2428}
2429
2430func isDropAll(op *api.Operation) bool {
2431 if op.DropAll || op.DropOp == api.Operation_ALL {

Callers 1

processQueryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected