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

Function toType

worker/export.go:364–378  ·  view source on GitHub ↗
(attr string, update pb.TypeUpdate)

Source from the content-addressed store, hash-verified

362}
363
364func toType(attr string, update pb.TypeUpdate) *bpb.KV {
365 var buf bytes.Buffer
366 ns, attr := x.ParseNamespaceAttr(attr)
367 x.Check2(buf.WriteString(fmt.Sprintf("[%#x] type <%s> {\n", ns, attr)))
368 for _, field := range update.Fields {
369 x.Check2(buf.WriteString(fieldToString(field)))
370 }
371
372 x.Check2(buf.WriteString("}\n"))
373
374 return &bpb.KV{
375 Value: buf.Bytes(),
376 Version: 3, // Type value
377 }
378}
379
380func fieldToString(update *pb.SchemaUpdate) string {
381 var builder strings.Builder

Callers 1

TypeExportKvFunction · 0.85

Calls 3

ParseNamespaceAttrFunction · 0.92
Check2Function · 0.92
fieldToStringFunction · 0.85

Tested by

no test coverage detected