ValidateFilters checks if both provided filters, tupleFilter and attributeFilter, are empty. It returns an error if both filters are empty, as at least one filter should contain criteria for the operation to be valid.
(tupleFilter *base.TupleFilter, attributeFilter *base.AttributeFilter)
| 58 | // ValidateFilters checks if both provided filters, tupleFilter and attributeFilter, are empty. |
| 59 | // It returns an error if both filters are empty, as at least one filter should contain criteria for the operation to be valid. |
| 60 | func ValidateFilters(tupleFilter *base.TupleFilter, attributeFilter *base.AttributeFilter) (err error) { |
| 61 | // Check if both tupleFilter and attributeFilter are empty using the respective functions. |
| 62 | // If both are empty, then there is nothing to validate, and an error is returned. |
| 63 | if IsTupleFilterEmpty(tupleFilter) && IsAttributeFilterEmpty(attributeFilter) { |
| 64 | // The error returned indicates a validation error due to both filters being empty. |
| 65 | return errors.New(base.ErrorCode_ERROR_CODE_VALIDATION.String()) |
| 66 | } |
| 67 | |
| 68 | // If at least one of the filters is not empty, then the validation is successful, and no error is returned. |
| 69 | return nil |
| 70 | } |
| 71 | |
| 72 | // ValidateAttribute checks whether a given attribute request (reqAttribute) aligns with |
| 73 | // the attribute definition in a given entity definition. It verifies if the attribute exists |
no test coverage detected