feat(aa): add the Merge method to the Rule interface.
This commit is contained in:
parent
d6424cb950
commit
42ca1be858
6 changed files with 25 additions and 18 deletions
|
|
@ -130,6 +130,17 @@ func (r *File) Compare(other Rule) int {
|
|||
return r.Qualifier.Compare(o.Qualifier)
|
||||
}
|
||||
|
||||
func (r *File) Merge(other Rule) bool {
|
||||
o, _ := other.(*File)
|
||||
if r.Path == o.Path {
|
||||
r.Access = append(r.Access, o.Access...)
|
||||
slices.SortFunc(r.Access, compareFileAccess)
|
||||
r.Access = slices.Compact(r.Access)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (r *File) String() string {
|
||||
return renderTemplate(r.Kind(), r)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue