arimelody.me/music/model/link.go

17 lines
268 B
Go
Raw Normal View History

package model
import (
"regexp"
"strings"
)
type Link struct {
Name string `json:"name"`
URL string `json:"url"`
}
func (link Link) NormaliseName() string {
rgx := regexp.MustCompile(`[^a-z0-9]`)
return strings.ToLower(rgx.ReplaceAllString(link.Name, ""))
}