github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/pkg/models/transaction.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 // Transaction schema for blockchain transaction information 10 // @def primary ID 11 // @def unique_index UI_transaction_id TransactionID 12 // @def index I_project_id ProjectID 13 // 14 //go:generate toolkit gen model Transaction --database DB 15 type Transaction struct { 16 datatypes.PrimaryID 17 RelTransaction 18 RelProject 19 TransactionInfo 20 datatypes.OperationTimesWithDeleted 21 } 22 23 type RelTransaction struct { 24 TransactionID types.SFID `db:"f_transaction_id" json:"transactionID"` 25 } 26 27 type TransactionInfo struct { 28 ChainName enums.ChainName `db:"f_chain_name" json:"chainName"` 29 Nonce uint64 `db:"f_nonce,default='0'" json:"nonce,omitempty"` 30 Hash string `db:"f_hash,default=''" json:"hash,omitempty"` 31 Sender string `db:"f_sender,default=''" json:"sender,omitempty"` 32 Receiver string `db:"f_receiver,default=''" json:"receiver,omitempty"` 33 Value string `db:"f_value,default=''" json:"value,omitempty"` 34 Data string `db:"f_data,default='',size=4096" json:"data,omitempty"` 35 OperatorName string `db:"f_operator_name,default=''" json:"operatorName,omitempty"` 36 State enums.TransactionState `db:"f_state,default='0'" json:"state,omitempty"` 37 EventType string `db:"f_event_type" json:"eventType"` 38 }