github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/pkg/models/chain_height.go (about)

     1  package models
     2  
     3  import (
     4  	"github.com/machinefi/w3bstream/pkg/depends/base/types"
     5  	"github.com/machinefi/w3bstream/pkg/depends/kit/sqlx/datatypes"
     6  	"github.com/machinefi/w3bstream/pkg/enums"
     7  )
     8  
     9  // ChainHeight database model chainheight
    10  // @def primary                   ID
    11  // @def unique_index UI_chain_height_id   ChainHeightID
    12  // @def unique_index UI_chain_height_uniq ProjectName EventType ChainID ChainName Height Uniq
    13  //
    14  //go:generate toolkit gen model ChainHeight --database MonitorDB
    15  type ChainHeight struct {
    16  	datatypes.PrimaryID
    17  	RelChainHeight
    18  	ChainHeightData
    19  	datatypes.OperationTimes
    20  }
    21  
    22  type RelChainHeight struct {
    23  	ChainHeightID types.SFID `db:"f_chain_height_id" json:"chainHeightID"`
    24  }
    25  
    26  type ChainHeightData struct {
    27  	ProjectName string         `db:"f_project_name"                 json:"projectName"`
    28  	Finished    datatypes.Bool `db:"f_finished,default='2'"         json:"-"`
    29  	Uniq        types.SFID     `db:"f_uniq,default='0'"             json:"-"`
    30  	ChainHeightInfo
    31  }
    32  
    33  type ChainHeightInfo struct {
    34  	EventType string          `db:"f_event_type"                   json:"eventType,omitempty,default='MONITOR_DEFAULT'"`
    35  	ChainID   uint64          `db:"f_chain_id,default='0'"         json:"chainID,omitempty"`
    36  	ChainName enums.ChainName `db:"f_chain_name,default=''"        json:"chainName,omitempty"`
    37  	Height    uint64          `db:"f_height"                       json:"height"`
    38  	Paused    datatypes.Bool  `db:"f_paused,default='2'"           json:"paused,omitempty,default='false'"`
    39  }