Skip to content

Instantly share code, notes, and snippets.

@kamal-kambe
Last active July 31, 2019 13:48
Show Gist options
  • Select an option

  • Save kamal-kambe/9d423e2b2996bd6c148d6e4bb60268c9 to your computer and use it in GitHub Desktop.

Select an option

Save kamal-kambe/9d423e2b2996bd6c148d6e4bb60268c9 to your computer and use it in GitHub Desktop.

Revisions

  1. kamal-kambe renamed this gist Jul 31, 2019. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. kamal-kambe revised this gist Jul 31, 2019. 1 changed file with 28 additions and 1 deletion.
    29 changes: 28 additions & 1 deletion building.go
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,9 @@
    package model

    import "time"
    import (
    "encoding/json"
    "time"
    )

    type Building struct {
    ID uint `gorm:"primary_key" json:"id"`
    @@ -10,4 +13,28 @@ type Building struct {
    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"`
    }
  3. kamal-kambe revised this gist Jul 31, 2019. 2 changed files with 13 additions and 14 deletions.
    13 changes: 13 additions & 0 deletions building.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    package model

    import "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
    }
    14 changes: 0 additions & 14 deletions player.go
    Original file line number Diff line number Diff line change
    @@ -1,14 +0,0 @@
    package model

    import "time"

    type Player struct {
    ID uint `gorm:"primary_key" json:"id"`
    CreatedAt time.Time `json:"-"`
    UpdatedAt time.Time `json:"-"`
    DeletedAt *time.Time `sql:"index" json:"-"`
    Name string `json:"name"`
    DeviceID string `sql:"UNIQUE;not null;index:idx_player_device_id" json:"device_id"`
    Email string `sql:"UNIQUE;not null;index:idx_player_email" json:"email"`
    Platform string
    }
  4. kamal-kambe created this gist Jul 31, 2019.
    14 changes: 14 additions & 0 deletions player.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    package model

    import "time"

    type Player struct {
    ID uint `gorm:"primary_key" json:"id"`
    CreatedAt time.Time `json:"-"`
    UpdatedAt time.Time `json:"-"`
    DeletedAt *time.Time `sql:"index" json:"-"`
    Name string `json:"name"`
    DeviceID string `sql:"UNIQUE;not null;index:idx_player_device_id" json:"device_id"`
    Email string `sql:"UNIQUE;not null;index:idx_player_email" json:"email"`
    Platform string
    }