arimelody.me/model/link.go

17 lines
276 B
Go
Raw Permalink 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, ""))
}