probo/models/collection.go

37 lines
589 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-11-13 21:01:12 +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) GetID() string {
return c.ID
}
func (c *Collection) SetID(id string) {
c.ID = id
}
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)
}