MCPcopy
hub / github.com/minio/minio-go / Equal

Method Equal

pkg/notification/notification.go:228–252  ·  pkg/notification/notification.go::Config.Equal

Equal returns whether this `Config` is equal to another defined by the passed parameters

(events []EventType, prefix, suffix string)

Source from the content-addressed store, hash-verified

226
227// Equal returns whether this `Config` is equal to another defined by the passed parameters
228func (t *Config) Equal(events []EventType, prefix, suffix string) bool {
229 if t == nil {
230 return false
231 }
232
233 // Compare events
234 passEvents := EqualEventTypeList(t.Events, events)
235
236 // Compare filters
237 var newFilterRules []FilterRule
238 if prefix != "" {
239 newFilterRules = append(newFilterRules, FilterRule{Name: "prefix", Value: prefix})
240 }
241 if suffix != "" {
242 newFilterRules = append(newFilterRules, FilterRule{Name: "suffix", Value: suffix})
243 }
244
245 var currentFilterRules []FilterRule
246 if t.Filter != nil {
247 currentFilterRules = t.Filter.S3Key.FilterRules
248 }
249
250 passFilters := EqualFilterRuleList(currentFilterRules, newFilterRules)
251 return passEvents && passFilters
252}
253
254// TopicConfig carries one single topic notification configuration
255type TopicConfig struct {

Calls 2

EqualEventTypeListFunction · 0.85
EqualFilterRuleListFunction · 0.85

Tested by 8

TestConfig_EqualFunction · 0.76
TestGetObjectCoreFunction · 0.64
TestCoreCopyObjectPartFunction · 0.64
TestConfigEqualFunction · 0.64
equalsMethod · 0.64
TestCORSXMLMarshalFunction · 0.64