github.com/loomnetwork/gamechain@v0.0.0-20200406110549-36c47eb97a92/tools/gamechain-logger/models/zb.go (about)

     1  package models
     2  
     3  import (
     4  	"encoding/json"
     5  	"time"
     6  )
     7  
     8  type Deck struct {
     9  	ID               int64           `json:"id" gorm:"PRIMARY_KEY"`
    10  	CreatedAt        time.Time       `json:"created_at"`
    11  	UpdatedAt        time.Time       `json:"updated_at"`
    12  	UserID           string          `json:"user_id" gorm:"INDEX"`
    13  	DeckID           int64           `json:"deck_id" gorm:"INDEX"`
    14  	Name             string          `json:"name" gorm:"INDEX"`
    15  	HeroID           int64           `json:"hero_id"`
    16  	Cards            json.RawMessage `json:"cards" sql:"type:mediumtext;"`
    17  	PrimarySkillID   int             `json:"primary_skill_id"`
    18  	SecondarySkillID int             `json:"secondary_skill_id"`
    19  	Version          string          `json:"version"`
    20  	SenderAddress    string          `json:"sender_address"`
    21  	BlockHeight      uint64          `json:"block_height" gorm:"INDEX"`
    22  	IsDeleted        bool            `json:"is_deleted"`
    23  }
    24  
    25  type Match struct {
    26  	ID              int64     `json:"id" gorm:"PRIMARY_KEY,auto_increment:false"`
    27  	CreatedAt       time.Time `json:"created_at"`
    28  	UpdatedAt       time.Time `json:"updated_at"`
    29  	Player1ID       string    `json:"player1_id"`
    30  	Player2ID       string    `json:"player2_id"`
    31  	Player1Accepted bool      `json:"player1_accepted"`
    32  	Player2Accepted bool      `json:"player2_accepted"`
    33  	Player1DeckID   int64     `json:"player1_deck_id"`
    34  	Player2DeckID   int64     `json:"player2_deck_id"`
    35  	Status          string    `json:"status" gorm:"index:status"`
    36  	Version         string    `json:"version"`
    37  	RandomSeed      int64     `json:"random_seed"`
    38  	WinnerID        string    `json:"winner_id"`
    39  	BlockHeight     uint64    `json:"block_height" gorm:"INDEX"`
    40  	BlockTime       time.Time `json:"block_time"`
    41  	Turns           int       `json:"turns"`
    42  	CardPlays       int       `json:"card_plays"`
    43  	CardAttacks     int       `json:"card_attacks"`
    44  }
    45  
    46  type Replay struct {
    47  	ID          int64     `gorm:"PRIMARY_KEY" json:"id"`
    48  	MatchID     int64     `json:"match_id"`
    49  	ReplayJSON  []byte    `json:"replay_json" sql:"type:mediumtext;"`
    50  	CreatedAt   time.Time `json:"created_at"`
    51  	UpdatedAt   time.Time `json:"updated_at"`
    52  	BlockHeight uint64    `json:"block_height"`
    53  	BlockTime   time.Time `json:"block_time"`
    54  }
    55  
    56  type Card struct {
    57  	ID          int64  `json:"id" gorm:"PRIMARY_KEY"`
    58  	MouldID     string `json:"mould_id" gorm:"UNIQUE_INDEX:idx_mouldid_version"`
    59  	Version     string `json:"version" gorm:"UNIQUE_INDEX:idx_mouldid_version"`
    60  	Kind        string `json:"kind"`
    61  	Set         string `json:"set"`
    62  	Name        string `json:"name"`
    63  	Description string `json:"description"`
    64  	FlavorText  string `json:"flavor_text"`
    65  	Picture     string `json:"picture"`
    66  	Rank        string `json:"rank"`
    67  	Type        string `json:"type"`
    68  	Rarity      string `json:"rarity"`
    69  	Frame       string `json:"frame"`
    70  	Damage      int32  `json:"damage"`
    71  	Health      int32  `json:"health"`
    72  	Cost        int32  `json:"cost"`
    73  	Ability     string `json:"ability"`
    74  	BlockHeight uint64 `json:"block_height"`
    75  	ImageURL    string `json:"image_url"`
    76  }
    77  
    78  type ZbHeightCheck struct {
    79  	Key             int64     `gorm:"not null;UNIQUE_INDEX:height_key;default=1" json:"key"`
    80  	LastBlockHeight uint64    `json:"last_block_height"`
    81  	UpdatedAt       time.Time `json:"updated_at"`
    82  }