package models import ( "crypto/md5" "encoding/hex" "fmt" "time" ) type Card struct { Id string Front string Back string LastCorrect time.Time Selected bool } func NewCard(front, back string) Card { id := GetMD5Hash(fmt.Sprintf("%s|%s", front, back)) return Card{Front: front, Back: back, Id: id} } func (c Card) FilterValue() string { return "" } func (c Card) ToString() string { return c.Front } func GetMD5Hash(text string) string { hash := md5.Sum([]byte(text)) return hex.EncodeToString(hash[:]) }