Skip to content

Instantly share code, notes, and snippets.

@kamal-kambe
Last active July 31, 2019 13:48
Show Gist options
  • Save kamal-kambe/9d423e2b2996bd6c148d6e4bb60268c9 to your computer and use it in GitHub Desktop.
Save kamal-kambe/9d423e2b2996bd6c148d6e4bb60268c9 to your computer and use it in GitHub Desktop.
package model
import (
"encoding/json"
"time"
)
type Building struct {
ID uint `gorm:"primary_key" json:"id"`
CreatedAt time.Time `json:"-"`
DeletedAt *time.Time `sql:"index" json:"-"`
Name string `gorm:"UNIQUE; not null" json:"name"`
DisplayName string `json:"display_name"`
Version uint `json:"version"`
BuildingLevels []*BuildingLevel
}
type BuildingLevel struct {
ID uint `gorm:"primary_key" json:"id"`
CreatedAt time.Time `json:"-"`
DeletedAt *time.Time `sql:"index" json:"-"`
BuildingID uint
LevelNo uint
Costs json.RawMessage `sql:"type:json"`
Version uint
}
type Quest struct {
ID uint `gorm:"primary_key" json:"id"`
CreatedAt time.Time `json:"-"`
DeletedAt *time.Time `sql:"index" json:"-"`
Name string `json:"name"`
Category string `json:"category"`
Description string `sql:"type:text"`
DependentQuestID uint `json:"dependent_quest_id"`
Task json.RawMessage `sql:"type:json"`
RequiredQuantity uint `gorm:"default:1" json:"required_quantity"`
Reward json.RawMessage `sql:"type:json"`
Version uint `json:"version"`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment