| 378 | } |
| 379 | |
| 380 | func 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 | |
| 398 | type ExportWriter struct { |
| 399 | fd *os.File |