fix(orm): fix failing tests (#16023)
This commit is contained in:
@@ -247,20 +247,19 @@ func (cdc KeyCodec) CheckValidRangeIterationKeys(start, end []protoreflect.Value
|
||||
y := end[i]
|
||||
|
||||
cmp = fieldCdc.Compare(x, y)
|
||||
switch {
|
||||
case cmp > 0:
|
||||
if cmp > 0 {
|
||||
return ormerrors.InvalidRangeIterationKeys.Wrapf(
|
||||
"start must be before end for field %s",
|
||||
cdc.fieldDescriptors[i].FullName(),
|
||||
)
|
||||
case !fieldCdc.IsOrdered() && cmp != 0:
|
||||
} else if !fieldCdc.IsOrdered() && cmp != 0 {
|
||||
descriptor := cdc.fieldDescriptors[i]
|
||||
return ormerrors.InvalidRangeIterationKeys.Wrapf(
|
||||
"field %s of kind %s doesn't support ordered range iteration",
|
||||
descriptor.FullName(),
|
||||
descriptor.Kind(),
|
||||
)
|
||||
case cmp < 0:
|
||||
} else if cmp < 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,9 +160,8 @@ func (u UniqueKeyCodec) EncodeEntry(entry Entry) (k, v []byte, err error) {
|
||||
if !fieldOrder.inKey {
|
||||
// goes in values because it is not present in the index key otherwise
|
||||
values = append(values, value)
|
||||
}
|
||||
// does not go in values, but we need to verify that the value in index values matches the primary key value
|
||||
if u.keyCodec.fieldCodecs[fieldOrder.i].Compare(value, indexEntry.IndexValues[fieldOrder.i]) != 0 {
|
||||
} else if u.keyCodec.fieldCodecs[fieldOrder.i].Compare(value, indexEntry.IndexValues[fieldOrder.i]) != 0 {
|
||||
// does not go in values, but we need to verify that the value in index values matches the primary key value
|
||||
return nil, nil, ormerrors.BadDecodeEntry.Wrapf("value in primary key does not match corresponding value in index key")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user