collection.go 481 B

12345678910111213141516171819202122232425262728
  1. package models
  2. import "encoding/json"
  3. type Collection struct {
  4. Meta
  5. Name string `json:"name"`
  6. // Filter *Filter `json:"filter"`
  7. Quizzes []*Quiz `json:"quizzes" gorm:"many2many:collection_quizzes"`
  8. }
  9. func (c *Collection) String() string {
  10. return c.Name
  11. }
  12. func (c *Collection) GetHash() string {
  13. return ""
  14. }
  15. func (c *Collection) Marshal() ([]byte, error) {
  16. return json.Marshal(c)
  17. }
  18. func (c *Collection) Unmarshal(data []byte) error {
  19. return json.Unmarshal(data, c)
  20. }