70 lines
2.1 KiB
Go
70 lines
2.1 KiB
Go
package entities
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type (
|
|
BlockWithTransactions struct {
|
|
Id int64 `db:"id"`
|
|
Hash []byte `db:"hash"`
|
|
PrevHash []byte `db:"prev_hash"`
|
|
StartedAt time.Time `db:"started_at"`
|
|
FinishedAt *time.Time `db:"finished_at"`
|
|
Transactions []Transaction `db:"transactions"`
|
|
}
|
|
|
|
Block struct {
|
|
Id int64 `db:"id"`
|
|
Hash []byte `db:"hash"`
|
|
PrevHash []byte `db:"prev_hash"`
|
|
StartedAt time.Time `db:"started_at"`
|
|
FinishedAt *time.Time `db:"finished_at"`
|
|
}
|
|
|
|
NewBlockOpts struct {
|
|
Id int64 `db:"id"`
|
|
Hash []byte `db:"hash"` // May be nil
|
|
PrevHash []byte `db:"prev_hash"` // May be nil
|
|
StartedAt time.Time `db:"started_at"`
|
|
FinishedAt *time.Time `db:"finished_at"` // May be nil
|
|
}
|
|
|
|
BlockFinishedOpts struct {
|
|
Id int64 `db:"id"`
|
|
Hash []byte `db:"hash"`
|
|
FinishedAt time.Time `db:"finished_at"`
|
|
}
|
|
)
|
|
|
|
type (
|
|
Transaction struct {
|
|
Hash []byte `db:"hash"`
|
|
BlockId int64 `db:"block_id"`
|
|
SenderPublicKey []byte `db:"sender_public_key"`
|
|
ReceiverPublicKey []byte `db:"receiver_public_key"`
|
|
IsReward bool `db:"is_reward"`
|
|
Amount float64 `db:"amount"`
|
|
AmountBurned float64 `db:"amount_burned"`
|
|
Message string `db:"message"`
|
|
Signature []byte `db:"signature"`
|
|
CreatedAt time.Time `db:"created_at"`
|
|
CreatedAtNs int64 `db:"created_at_ns"`
|
|
AddedAt time.Time `db:"added_at"`
|
|
}
|
|
|
|
NewTransactionOpts struct {
|
|
Hash []byte `db:"hash"`
|
|
BlockId int64 `db:"block_id"`
|
|
SenderPublicKey []byte `db:"sender_public_key"`
|
|
ReceiverPublicKey []byte `db:"receiver_public_key"`
|
|
IsReward bool `db:"is_reward"`
|
|
Amount float64 `db:"amount"`
|
|
AmountBurned float64 `db:"amount_burned"`
|
|
Message string `db:"message"`
|
|
Signature []byte `db:"signature"`
|
|
CreatedAt time.Time `db:"created_at"`
|
|
CreatedAtNs int64 `db:"created_at_ns"`
|
|
}
|
|
)
|