response.go 499 B

1234567891011121314151617181920212223242526272829
  1. package models
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. )
  6. type Response struct {
  7. Meta
  8. Questions map[string]string
  9. }
  10. func (r *Response) String() string {
  11. return fmt.Sprintf("Questions/Answers: %v", r.Questions)
  12. }
  13. func (r *Response) GetHash() string {
  14. // return fmt.Sprintf("%x", sha256.Sum256([]byte(r.QuestionID+r.AnswerID)))
  15. return ""
  16. }
  17. func (r *Response) Marshal() ([]byte, error) {
  18. return json.Marshal(r)
  19. }
  20. func (r *Response) Unmarshal(data []byte) error {
  21. return json.Unmarshal(data, r)
  22. }