41 lines
659 B
Go
41 lines
659 B
Go
package models
|
|
|
|
import "encoding/json"
|
|
|
|
type Collection struct {
|
|
Meta
|
|
|
|
Name string `json:"name"`
|
|
Filter *Filter `json:"filter"`
|
|
|
|
Quizzes []*Quiz `json:"quizzes" gorm:"many2many:collection_quizzes"`
|
|
}
|
|
|
|
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 ""
|
|
}
|
|
|
|
func (c *Collection) Marshal() ([]byte, error) {
|
|
return json.Marshal(c)
|
|
|
|
}
|
|
|
|
func (c *Collection) Unmarshal(data []byte) error {
|
|
return json.Unmarshal(data, c)
|
|
}
|
|
|
|
func (c *Collection) Create() *Collection {
|
|
return &Collection{}
|
|
}
|