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

Function TestToSchema

worker/export_test.go:440–555  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

438}
439
440func TestToSchema(t *testing.T) {
441 testCases := []struct {
442 skv *skv
443 expected string
444 }{
445 {
446 skv: &skv{
447 attr: x.AttrInRootNamespace("Alice"),
448 schema: pb.SchemaUpdate{
449 Predicate: x.AttrInRootNamespace("mother"),
450 ValueType: pb.Posting_STRING,
451 Directive: pb.SchemaUpdate_REVERSE,
452 List: false,
453 Count: true,
454 Upsert: true,
455 Lang: true,
456 },
457 },
458 expected: "[0x0] <Alice>:string @reverse @count @lang @upsert . \n",
459 },
460 {
461 skv: &skv{
462 attr: x.NamespaceAttr(0xf2, "Alice:best"),
463 schema: pb.SchemaUpdate{
464 Predicate: x.NamespaceAttr(0xf2, "mother"),
465 ValueType: pb.Posting_STRING,
466 Directive: pb.SchemaUpdate_REVERSE,
467 List: false,
468 Count: false,
469 Upsert: false,
470 Lang: true,
471 },
472 },
473 expected: "[0xf2] <Alice:best>:string @reverse @lang . \n",
474 },
475 {
476 skv: &skv{
477 attr: x.AttrInRootNamespace("username/password"),
478 schema: pb.SchemaUpdate{
479 Predicate: x.AttrInRootNamespace(""),
480 ValueType: pb.Posting_STRING,
481 Directive: pb.SchemaUpdate_NONE,
482 List: false,
483 Count: false,
484 Upsert: false,
485 Lang: false,
486 },
487 },
488 expected: "[0x0] <username/password>:string . \n",
489 },
490 {
491 skv: &skv{
492 attr: x.AttrInRootNamespace("B*-tree"),
493 schema: pb.SchemaUpdate{
494 Predicate: x.AttrInRootNamespace(""),
495 ValueType: pb.Posting_UID,
496 Directive: pb.SchemaUpdate_REVERSE,
497 List: true,

Callers

nothing calls this directly

Calls 3

AttrInRootNamespaceFunction · 0.92
NamespaceAttrFunction · 0.92
toSchemaFunction · 0.85

Tested by

no test coverage detected