IsAttributeFilterEmpty checks if the provided AttributeFilter object is empty. An AttributeFilter is considered empty if none of its fields have been set.
(filter *base.AttributeFilter)
| 147 | // IsAttributeFilterEmpty checks if the provided AttributeFilter object is empty. |
| 148 | // An AttributeFilter is considered empty if none of its fields have been set. |
| 149 | func IsAttributeFilterEmpty(filter *base.AttributeFilter) bool { |
| 150 | // Check if the Entity type field of the filter is set. If it is, the filter is not empty. |
| 151 | if filter.GetEntity().GetType() != "" { |
| 152 | return false // Entity type is specified, hence the filter is not empty. |
| 153 | } |
| 154 | |
| 155 | // Check if the Entity IDs field of the filter has any IDs. If it does, the filter is not empty. |
| 156 | if len(filter.GetEntity().GetIds()) > 0 { |
| 157 | return false // Entity IDs are specified, hence the filter is not empty. |
| 158 | } |
| 159 | |
| 160 | // Check if the Attributes field of the filter has any attributes set. If it does, the filter is not empty. |
| 161 | if len(filter.GetAttributes()) > 0 { |
| 162 | return false // Attributes are specified, hence the filter is not empty. |
| 163 | } |
| 164 | |
| 165 | // If none of the above fields are set, then the filter is considered empty. |
| 166 | return true |
| 167 | } |
| 168 | |
| 169 | // ValidateBundleOperation checks for duplicate keys in various operations of a bundle. |
| 170 | func ValidateBundleOperation(op *base.Operation) error { |
no test coverage detected