1234567891011121314151617181920 |
- 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)))
- }
|