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

Function fieldToString

worker/export.go:380–396  ·  view source on GitHub ↗
(update *pb.SchemaUpdate)

Source from the content-addressed store, hash-verified

378}
379
380func fieldToString(update *pb.SchemaUpdate) string {
381 var builder strings.Builder
382 predicate := x.ParseAttr(update.Predicate)
383 x.Check2(builder.WriteString("\t"))
384 // We don't need the namespace information with the fields. We already have that with type.
385 if strings.HasPrefix(predicate, "~") {
386 // While exporting type definitions, "<" and ">" brackets must be written around
387 // the name of reverse predicates or Dgraph won't be able to parse the exported schema.
388 x.Check2(builder.WriteString("<"))
389 x.Check2(builder.WriteString(predicate))
390 x.Check2(builder.WriteString(">"))
391 } else {
392 x.Check2(builder.WriteString(predicate))
393 }
394 x.Check2(builder.WriteString("\n"))
395 return builder.String()
396}
397
398type ExportWriter struct {
399 fd *os.File

Callers 1

toTypeFunction · 0.85

Calls 3

ParseAttrFunction · 0.92
Check2Function · 0.92
StringMethod · 0.45

Tested by

no test coverage detected