(attr string, update pb.TypeUpdate)
| 362 | } |
| 363 | |
| 364 | func 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 | |
| 380 | func fieldToString(update *pb.SchemaUpdate) string { |
| 381 | var builder strings.Builder |
no test coverage detected