probo/models/answer.go

27 lines
394 B
Go

package models
import (
"crypto/sha256"
"fmt"
)
type Answer struct {
ID string `json:"id" gorm:"primaryKey"`
Text string `json:"text"`
}
func (a *Answer) String() string {
return a.Text
}
func (a *Answer) GetID() string {
return a.ID
}
func (a *Answer) SetID(id string) {
a.ID = id
}
func (a *Answer) GetHash() string {
return fmt.Sprintf("%x", sha256.Sum256([]byte(a.Text)))
}