probo/pkg/models/answer.go

21 lines
303 B
Go
Raw Normal View History

2022-06-23 11:25:35 +02:00
package models
2023-11-13 21:01:12 +01:00
import (
"crypto/sha256"
"fmt"
)
2022-06-23 11:25:35 +02:00
type Answer struct {
2023-12-05 22:11:08 +01:00
// ID string `json:"id" gorm:"primaryKey"`
Meta
2023-07-12 09:30:56 +02:00
Text string `json:"text"`
2022-06-23 11:25:35 +02:00
}
2023-11-13 21:01:12 +01:00
func (a *Answer) String() string {
return a.Text
}
func (a *Answer) GetHash() string {
return fmt.Sprintf("%x", sha256.Sum256([]byte(a.Text)))
}