typeSanityCheck performs basic sanity checks on the given type update.
(t *pb.TypeUpdate)
| 861 | |
| 862 | // typeSanityCheck performs basic sanity checks on the given type update. |
| 863 | func typeSanityCheck(t *pb.TypeUpdate) error { |
| 864 | for _, field := range t.Fields { |
| 865 | if x.ParseAttr(field.Predicate) == "" { |
| 866 | return errors.Errorf("Field in type definition must have a name") |
| 867 | } |
| 868 | |
| 869 | if field.ValueType == pb.Posting_OBJECT && field.ObjectTypeName == "" { |
| 870 | return errors.Errorf( |
| 871 | "Field with value type OBJECT must specify the name of the object type") |
| 872 | } |
| 873 | |
| 874 | if field.Directive != pb.SchemaUpdate_NONE { |
| 875 | return errors.Errorf("Field in type definition cannot have a directive") |
| 876 | } |
| 877 | |
| 878 | if len(field.Tokenizer) > 0 { |
| 879 | return errors.Errorf("Field in type definition cannot have tokenizers") |
| 880 | } |
| 881 | } |
| 882 | |
| 883 | return nil |
| 884 | } |
| 885 | |
| 886 | // CommitOverNetwork makes a proxy call to Zero to commit or abort a transaction. |
| 887 | func CommitOverNetwork(ctx context.Context, tc *api.TxnContext) (uint64, error) { |