probo/models/answer.go
2023-12-05 22:11:08 +01:00

20 lines
303 B
Go

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