(t *testing.T)
| 47 | ` |
| 48 | |
| 49 | func TestSchema(t *testing.T) { |
| 50 | require.NoError(t, ParseBytes([]byte(schemaVal), 1)) |
| 51 | checkSchema(t, State().predicate, []nameType{ |
| 52 | {x.AttrInRootNamespace("name"), &pb.SchemaUpdate{ |
| 53 | Predicate: x.AttrInRootNamespace("name"), |
| 54 | ValueType: pb.Posting_STRING, |
| 55 | }}, |
| 56 | {x.AttrInRootNamespace("address"), &pb.SchemaUpdate{ |
| 57 | Predicate: x.AttrInRootNamespace("address"), |
| 58 | ValueType: pb.Posting_STRING, |
| 59 | }}, |
| 60 | {x.AttrInRootNamespace("http://scalar.com/helloworld/"), &pb.SchemaUpdate{ |
| 61 | Predicate: x.AttrInRootNamespace("http://scalar.com/helloworld/"), |
| 62 | ValueType: pb.Posting_STRING, |
| 63 | }}, |
| 64 | {x.AttrInRootNamespace("age"), &pb.SchemaUpdate{ |
| 65 | Predicate: x.AttrInRootNamespace("age"), |
| 66 | ValueType: pb.Posting_INT, |
| 67 | }}, |
| 68 | {x.AttrInRootNamespace("amount"), &pb.SchemaUpdate{ |
| 69 | Predicate: x.AttrInRootNamespace("amount"), |
| 70 | ValueType: pb.Posting_BIGFLOAT, |
| 71 | }}, |
| 72 | {x.AttrInRootNamespace("coordinates"), &pb.SchemaUpdate{ |
| 73 | Predicate: x.AttrInRootNamespace("coordinates"), |
| 74 | ValueType: pb.Posting_VFLOAT, |
| 75 | }}, |
| 76 | {x.AttrInRootNamespace("indexvector"), &pb.SchemaUpdate{ |
| 77 | Predicate: x.AttrInRootNamespace("indexvector"), |
| 78 | ValueType: pb.Posting_VFLOAT, |
| 79 | Tokenizer: []string{}, |
| 80 | Directive: pb.SchemaUpdate_INDEX, |
| 81 | IndexSpecs: []*pb.VectorIndexSpec{ |
| 82 | { |
| 83 | Name: "hnsw", |
| 84 | Options: []*pb.OptionPair{ |
| 85 | { |
| 86 | Key: "metric", |
| 87 | Value: "euclidean", |
| 88 | }, |
| 89 | }, |
| 90 | }, |
| 91 | }, |
| 92 | }}, |
| 93 | }) |
| 94 | |
| 95 | typ, err := State().TypeOf(x.AttrInRootNamespace("age")) |
| 96 | require.NoError(t, err) |
| 97 | require.Equal(t, types.IntID, typ) |
| 98 | |
| 99 | typ, err = State().TypeOf(x.AttrInRootNamespace("amount")) |
| 100 | require.NoError(t, err) |
| 101 | require.Equal(t, types.BigFloatID, typ) |
| 102 | |
| 103 | typ, err = State().TypeOf(x.AttrInRootNamespace("coordinates")) |
| 104 | require.NoError(t, err) |
| 105 | require.Equal(t, types.VFloatID, typ) |
| 106 |
nothing calls this directly
no test coverage detected