answer.go 303 B

1234567891011121314151617181920
  1. package models
  2. import (
  3. "crypto/sha256"
  4. "fmt"
  5. )
  6. type Answer struct {
  7. // ID string `json:"id" gorm:"primaryKey"`
  8. Meta
  9. Text string `json:"text"`
  10. }
  11. func (a *Answer) String() string {
  12. return a.Text
  13. }
  14. func (a *Answer) GetHash() string {
  15. return fmt.Sprintf("%x", sha256.Sum256([]byte(a.Text)))
  16. }