question.go 263 B

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