question.go 367 B

123456789101112131415161718192021222324252627
  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) GetID() string {
  14. return q.ID
  15. }
  16. func (q *Question) SetID(id string) {
  17. q.ID = id
  18. }
  19. func (q *Question) GetHash() string {
  20. return fmt.Sprintf("%x", sha256.Sum256([]byte(q.Text)))
  21. }