probo/pkg/models/collection.go

29 lines
481 B
Go
Raw Normal View History

2023-10-07 11:43:12 +02:00
package models
2023-11-20 14:14:09 +01:00
import "encoding/json"
2023-10-07 11:43:12 +02:00
type Collection struct {
2023-10-28 20:50:06 +02:00
Meta
2023-12-05 22:11:08 +01:00
Name string `json:"name"`
// Filter *Filter `json:"filter"`
2023-10-07 11:43:12 +02:00
2023-10-28 20:50:06 +02:00
Quizzes []*Quiz `json:"quizzes" gorm:"many2many:collection_quizzes"`
2023-10-07 11:43:12 +02:00
}
2023-11-13 21:01:12 +01:00
func (c *Collection) String() string {
return c.Name
}
func (c *Collection) GetHash() string {
return ""
}
2023-11-20 14:14:09 +01:00
func (c *Collection) Marshal() ([]byte, error) {
return json.Marshal(c)
}
func (c *Collection) Unmarshal(data []byte) error {
return json.Unmarshal(data, c)
}