micw/server/repository/entities/entities.go
2024-11-24 15:04:52 +01:00

54 lines
1.6 KiB
Go

package entities
import (
"time"
)
type (
BlockWithTransactions struct {
Id int64 `db:"id"`
Hash []byte `db:"hash"`
PrevHash []byte `db:"prev_hash"`
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"`
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 int64 `db:"created_at"`
CreatedAtNs int64 `db:"created_at_ns"`
}
)