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:
@@ -8,6 +8,13 @@ type Domain struct {
|
||||
CatchAllUser *CatchAllUser
|
||||
}
|
||||
|
||||
// DomainSlice attaches the methods of sort.Interface to []*Domain.
|
||||
type DomainSlice []*Domain
|
||||
|
||||
func (p DomainSlice) Len() int { return len(p) }
|
||||
func (p DomainSlice) Less(i, j int) bool { return p[i].Name() < p[j].Name() }
|
||||
func (p DomainSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
|
||||
|
||||
// NewDomain creates a new Domain instance.
|
||||
func NewDomain(name string) (*Domain, error) {
|
||||
if !validDomainName(name) {
|
||||
|
||||
Reference in New Issue
Block a user