dbmodels

package
v0.0.0-...-fa2bc5f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2021 License: ISC Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AcceptedBlockFieldNames = struct {
	Block         FieldName
	AcceptedBlock FieldName
}{
	Block:         "Block",
	AcceptedBlock: "AcceptedBlock",
}

AcceptedBlockFieldNames is a list of FieldNames for the 'AcceptedBlock' object

View Source
var BlockFieldNames = struct {
	ParentBlocks,
	Transactions FieldName
}{
	ParentBlocks: "ParentBlocks",
	Transactions: "Transactions",
}

BlockFieldNames is a list of FieldNames for the 'Block' object

View Source
var BlockRecommendedPreloadedFields = []FieldName{
	BlockFieldNames.ParentBlocks,
}

BlockRecommendedPreloadedFields is a list of fields recommended to preload when getting blocks

View Source
var ParentBlockFieldNames = struct {
	Block       FieldName
	ParentBlock FieldName
}{
	Block:       "Block",
	ParentBlock: "ParentBlock",
}

ParentBlockFieldNames is a list of FieldNames for the 'ParentBlock' object

View Source
var RawBlockFieldNames = struct {
	Block FieldName
}{
	Block: "Block",
}

RawBlockFieldNames is a list of FieldNames for the 'RawBlock' object

View Source
var TransactionBlockFieldNames = struct {
	Transaction FieldName
	Block       FieldName
}{
	Transaction: "Transaction",
	Block:       "Block",
}

TransactionBlockFieldNames is a list of FieldNames for the 'TransactionBlock' object

View Source
var TransactionFieldNames = struct {
	AcceptingBlock                   FieldName
	Subnetwork                       FieldName
	Blocks                           FieldName
	TransactionOutputs               FieldName
	TransactionInputs                FieldName
	OutputsAddresses                 FieldName
	InputsPreviousTransactionOutputs FieldName
	InputsPreviousTransactions       FieldName
	InputsAddresses                  FieldName
	InputsValues                     FieldName
}{
	AcceptingBlock:                   "AcceptingBlock",
	Subnetwork:                       "Subnetwork",
	Blocks:                           "Blocks",
	TransactionOutputs:               "TransactionOutputs",
	TransactionInputs:                "TransactionInputs",
	OutputsAddresses:                 "TransactionOutputs.Address",
	InputsPreviousTransactionOutputs: "TransactionInputs.PreviousTransactionOutput",
	InputsPreviousTransactions:       "TransactionInputs.PreviousTransactionOutput.Transaction",
	InputsAddresses:                  "TransactionInputs.PreviousTransactionOutput.Address",
	InputsValues:                     "TransactionInputs.PreviousTransactionOutput.value",
}

TransactionFieldNames is a list of FieldNames for the 'Transaction' object

View Source
var TransactionInputFieldNames = struct {
	Transaction               FieldName
	PreviousTransactionOutput FieldName
}{
	Transaction:               "Transaction",
	PreviousTransactionOutput: "PreviousTransactionOutput",
}

TransactionInputFieldNames is a list of FieldNames for the 'TransactionInput' object

View Source
var TransactionOutputFieldNames = struct {
	Transaction               FieldName
	Address                   FieldName
	TransactionAcceptingBlock FieldName
	TransactionSubnetwork     FieldName
}{
	Transaction:               "Transaction",
	Address:                   "Address",
	TransactionAcceptingBlock: "Transaction.AcceptingBlock",
	TransactionSubnetwork:     "Transaction.Subnetwork",
}

TransactionOutputFieldNames is a list of FieldNames for the 'TransactionOutput' object

View Source
var TransactionRecommendedPreloadedFields = []FieldName{
	TransactionFieldNames.AcceptingBlock,
	TransactionFieldNames.Subnetwork,
	TransactionFieldNames.TransactionOutputs,
	TransactionFieldNames.OutputsAddresses,
	TransactionFieldNames.InputsPreviousTransactions,
	TransactionFieldNames.InputsAddresses,
	TransactionFieldNames.InputsValues,
}

TransactionRecommendedPreloadedFields is a list of fields recommended to preload when getting transactions

Functions

This section is empty.

Types

type AcceptedBlock

type AcceptedBlock struct {
	BlockID         uint64
	Block           Block
	AcceptedBlockID uint64
	AcceptedBlock   Block
}

AcceptedBlock is the database model for the 'accepted_blocks' table

type Address

type Address struct {
	ID      uint64 `pg:",pk"`
	Address string `pg:",use_zero"`
}

Address is the database model for the 'addresses' table

type Block

type Block struct {
	ID                   uint64 `pg:",pk"`
	BlockHash            string `pg:",use_zero"`
	AcceptingBlockID     *uint64
	AcceptingBlock       *Block
	Version              uint16         `pg:",use_zero"`
	HashMerkleRoot       string         `pg:",use_zero"`
	AcceptedIDMerkleRoot string         `pg:",use_zero"`
	UTXOCommitment       string         `pg:",use_zero"`
	Timestamp            time.Time      `pg:",use_zero"`
	Bits                 uint32         `pg:",use_zero"`
	Nonce                []byte         `pg:",use_zero"`
	BlueScore            uint64         `pg:",use_zero"`
	IsChainBlock         bool           `pg:",use_zero"`
	TransactionCount     uint16         `pg:",use_zero"`
	Difficulty           float64        `pg:",use_zero"`
	ParentBlocks         []*Block       `pg:"many2many:parent_blocks,joinFK:parent_block_id"`
	AcceptedBlocks       []*Block       `pg:"many2many:accepted_blocks,joinFK:accepted_block_id"`
	Transactions         []*Transaction `pg:"many2many:transactions_to_blocks,joinFK:transaction_id"`
}

Block is the database model for the 'blocks' table

type FieldName

type FieldName string

FieldName is the string reprenetation for field names of database models. Used to specify which fields to preload

func PrefixFieldName

func PrefixFieldName(prefix FieldName, field FieldName) FieldName

PrefixFieldName returns the given field prefixed with the given prefix and a dot.

func PrefixFieldNames

func PrefixFieldNames(prefix FieldName, fields []FieldName) []FieldName

PrefixFieldNames returns the given fields prefixed with the given prefix and a dot.

type ParentBlock

type ParentBlock struct {
	BlockID       uint64
	Block         Block
	ParentBlockID uint64
	ParentBlock   Block
}

ParentBlock is the database model for the 'parent_blocks' table

type RawBlock

type RawBlock struct {
	BlockID   uint64
	Block     Block
	BlockData []byte
}

RawBlock is the database model for the 'raw_blocks' table

type Subnetwork

type Subnetwork struct {
	ID           uint64 `pg:",pk"`
	SubnetworkID string `pg:",use_zero"`
	GasLimit     *uint64
}

Subnetwork is the database model for the 'subnetworks' table

type Transaction

type Transaction struct {
	ID                 uint64 `pg:",pk"`
	AcceptingBlockID   *uint64
	AcceptingBlock     *Block
	TransactionHash    string `pg:",use_zero"`
	TransactionID      string `pg:",use_zero"`
	LockTime           []byte `pg:",use_zero"`
	SubnetworkID       uint64 `pg:",use_zero"`
	Subnetwork         Subnetwork
	Gas                uint64  `pg:",use_zero"`
	Payload            []byte  `pg:",use_zero"`
	Mass               uint64  `pg:",use_zero"`
	Version            uint16  `pg:",use_zero"`
	Blocks             []Block `pg:"many2many:transactions_to_blocks"`
	TransactionOutputs []TransactionOutput
	TransactionInputs  []TransactionInput
}

Transaction is the database model for the 'transactions' table

type TransactionBlock

type TransactionBlock struct {
	TransactionID uint64 `pg:",use_zero"`
	Transaction   Transaction
	BlockID       uint64 `pg:",use_zero"`
	Block         Block
	Index         uint32 `pg:",use_zero"`
	// contains filtered or unexported fields
}

TransactionBlock is the database model for the 'transactions_to_blocks' table

func (TransactionBlock) TableName

func (TransactionBlock) TableName() string

TableName returns the table name associated to the TransactionBlock gorm model

type TransactionInput

type TransactionInput struct {
	ID                             uint64 `pg:",pk"`
	TransactionID                  uint64 `pg:",use_zero"`
	Transaction                    Transaction
	PreviousTransactionOutputID    uint64 `pg:",use_zero"`
	PreviousTransactionOutputIndex uint32 `pg:",use_zero"`
	PreviousTransactionID          string `pg:",use_zero"`
	PreviousTransactionOutput      *TransactionOutput
	Index                          uint32 `pg:",use_zero"`
	SignatureScript                []byte `pg:",use_zero"`
	Sequence                       []byte `pg:",use_zero"`
}

TransactionInput is the database model for the 'transaction_inputs' table

type TransactionOutput

type TransactionOutput struct {
	ID            uint64 `pg:",pk"`
	TransactionID uint64 `pg:",use_zero"`
	Transaction   Transaction
	Index         uint32 `pg:",use_zero"`
	Value         uint64 `pg:",use_zero"`
	ScriptPubKey  []byte `pg:",use_zero"`
	IsSpent       bool   `pg:",use_zero"`
	AddressID     *uint64
	Address       *Address
}

TransactionOutput is the database model for the 'transaction_outputs' table

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL