Quizzes
Quiz model in ClueQuest Go SDK
Schema
Field | Type | Description | Extra Info |
---|---|---|---|
ID | uuid.UUID | Unique identifier for the quiz. | Primary Key |
Name | string | Name of the quiz. | unique , not null |
DisplayName | string | Display name of the quiz. | not null |
CreatedBy | uuid.UUID | Identifier of the user who created the quiz. | Relation to User model |
UpdatedBy | uuid.UUID | Identifier of the user who last updated the quiz. | Relation to User model |
CreatedAt | time.Time | Timestamp of when the quiz was created. | Set automatically to current time at creation |
UpdatedAt | time.Time | Timestamp of the last update to the quiz. | Set automatically to current time at update |
DeletedAt | gorm.DeletedAt | Timestamp of when the quiz was deleted (if applicable). | It is needed for soft deletion. |
Model
type Quiz struct {
ID uuid.UUID `gorm:"type:uuid;primaryKey;default:uuid_generate_v4()" json:"id"`
Name string `gorm:"not null" json:"name"`
Config interface{} `gorm:"type:jsonb" json:"config"`
CreatedBy uuid.UUID `gorm:"type:uuid;not null" json:"created_by"`
UpdatedBy uuid.UUID `gorm:"type:uuid" json:"updated_by"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
Creator User `gorm:"foreignKey:CreatedBy;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" json:"creator,omitempty"`
Updater User `gorm:"foreignKey:UpdatedBy;constraint:OnUpdate:CASCADE,OnDelete:SET NULL;" json:"updater,omitempty"`
}
Relationships
Creator
: Many-to-one relationship with the User model. A quiz is created by a single user.Updater
: Many-to-one relationship with the User model. A quiz is last updated by a single user.