github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/pkg/models/chain_tx.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  )
     7  
     8  // ChainTx database model chain tx
     9  // @def primary                   ID
    10  // @def unique_index UI_chain_tx_id   ChainTxID
    11  // @def unique_index UI_chain_tx_uniq ProjectName EventType ChainID TxAddress Uniq
    12  //
    13  //go:generate toolkit gen model ChainTx --database MonitorDB
    14  type ChainTx struct {
    15  	datatypes.PrimaryID
    16  	RelChainTx
    17  	ChainTxData
    18  	datatypes.OperationTimes
    19  }
    20  
    21  type RelChainTx struct {
    22  	ChainTxID types.SFID `db:"f_chaintx_id" json:"chaintxID"`
    23  }
    24  
    25  type ChainTxData struct {
    26  	ProjectName string         `db:"f_project_name"                 json:"projectName"`
    27  	Finished    datatypes.Bool `db:"f_finished,default='2'"         json:"-"`
    28  	Uniq        types.SFID     `db:"f_uniq,default='0'"             json:"-"`
    29  	ChainTxInfo
    30  }
    31  
    32  type ChainTxInfo struct {
    33  	EventType string         `db:"f_event_type"                   json:"eventType,omitempty,default='MONITOR_DEFAULT'"`
    34  	ChainID   uint64         `db:"f_chain_id"                     json:"chainID"`
    35  	TxAddress string         `db:"f_tx_address"                   json:"txAddress"`
    36  	Paused    datatypes.Bool `db:"f_paused,default='2'"           json:"paused,omitempty,default='false'"`
    37  }