20 lines
303 B
Go
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)))
|
|
}
|