Skip to content

Commit b6f2976

Browse files
committed
update models struct tags
1 parent b009575 commit b6f2976

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

models/block.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ import (
55
)
66

77
type Block struct {
8-
ID uint64 `json:"id" sql:",pk"`
9-
TotalTxs uint64 `json:"total_txs" sql:"default:0"`
8+
ID uint64 `json:"id" pg:",pk"`
9+
TotalTxs uint64 `json:"total_txs" pg:"default:0"`
1010
Size uint64 `json:"size"`
1111
ProposerValidatorID uint64 `json:"proposer_validator_id"`
12-
NumTxs uint32 `json:"num_txs" sql:"default:0"`
12+
NumTxs uint32 `json:"num_txs" pg:"default:0"`
1313
BlockTime uint64 `json:"block_time"`
1414
CreatedAt time.Time `json:"created_at"`
1515
UpdatedAt time.Time `json:"updated_at"`
16-
BlockReward string `json:"block_reward" sql:"type:numeric(70)"`
16+
BlockReward string `json:"block_reward" pg:"type:numeric(70)"`
1717
Hash string `json:"hash"`
18-
Proposer *Validator `json:"proposer" sql:"fk:proposer_validator_id"` //relation has one to Validators
19-
Validators []*Validator `json:"validators" sql:"many2many:block_validator"` //relation has many to Validators
20-
Transactions []*Transaction `json:"transactions"` //relation has many to Transactions
21-
InvalidTransactions []*InvalidTransaction `json:"invalid_transactions"` //relation has many to InvalidTransactions
22-
Rewards []*Reward `json:"rewards"` //relation has many to Rewards
23-
Slashes []*Slash `json:"slashes"` //relation has many to Slashes
18+
Proposer *Validator `json:"proposer" pg:"fk:proposer_validator_id"` //relation has one to Validators
19+
Validators []*Validator `json:"validators" pg:"many2many:block_validator"` //relation has many to Validators
20+
Transactions []*Transaction `json:"transactions"` //relation has many to Transactions
21+
InvalidTransactions []*InvalidTransaction `json:"invalid_transactions"` //relation has many to InvalidTransactions
22+
Rewards []*Reward `json:"rewards"` //relation has many to Rewards
23+
Slashes []*Slash `json:"slashes"` //relation has many to Slashes
2424
BlockValidators []BlockValidator `json:"block_validators"`
2525
}
2626

models/transaction.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
)
77

88
type Transaction struct {
9-
ID uint64 `json:"id" sql:",pk"`
9+
ID uint64 `json:"id" pg:",pk"`
1010
FromAddressID uint64 `json:"from_address_id"`
1111
Nonce uint64 `json:"nonce"`
1212
GasPrice uint64 `json:"gas_price"`
@@ -18,7 +18,7 @@ type Transaction struct {
1818
Hash string `json:"hash"`
1919
ServiceData string `json:"service_data"`
2020
Data json.RawMessage `json:"data"`
21-
IData interface{} `json:"-" sql:"-"`
21+
IData interface{} `json:"-" pg:"-"`
2222
Tags map[string]string `json:"tags"`
2323
Payload []byte `json:"payload"`
2424
RawTx []byte `json:"raw_tx"`

0 commit comments

Comments
 (0)