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