mirror of
https://github.com/directorz/mailfull-go.git
synced 2025-12-17 09:37:02 +00:00
Implement sort.Interface to required struct slice
This commit is contained in:
@@ -6,6 +6,13 @@ type AliasDomain struct {
|
||||
target string
|
||||
}
|
||||
|
||||
// AliasDomainSlice attaches the methods of sort.Interface to []*AliasDomain.
|
||||
type AliasDomainSlice []*AliasDomain
|
||||
|
||||
func (p AliasDomainSlice) Len() int { return len(p) }
|
||||
func (p AliasDomainSlice) Less(i, j int) bool { return p[i].Name() < p[j].Name() }
|
||||
func (p AliasDomainSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
|
||||
|
||||
// NewAliasDomain creates a new AliasDomain instance.
|
||||
func NewAliasDomain(name, target string) (*AliasDomain, error) {
|
||||
if !validAliasDomainName(name) {
|
||||
|
||||
Reference in New Issue
Block a user