models

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const BlockTableName = "blocks"
View Source
const TransactionTableName = "transactions"

Variables

This section is empty.

Functions

func Init

func Init(pgdb *pg.DB) error

Types

type Block

type Block struct {
	BlockHash         string `pg:"blockHash,pk" json:"blockHash"`
	Network           string `pg:"network" json:"network"`
	BlockNumber       uint64 `pg:"blockNumber" json:"blockNumber"`
	PrevioudBlockHash string `pg:"preBlockHash" json:"preBlockHash"`
	DataHash          string `pg:"dataHash" json:"dataHash"`
	CreatedAt         int64  `pg:"createdAt" json:"createdAt"`
	BlockSize         int    `pg:"blockSize" json:"blockSize"`
	TxCount           int    `pg:"txCount" json:"txCount"`
}

func (*Block) AfterQuery

func (*Block) AfterQuery(ctx context.Context, event *pg.QueryEvent) error

func (*Block) BeforeQuery

func (*Block) BeforeQuery(ctx context.Context, event *pg.QueryEvent) (context.Context, error)

type FabRWSet

type FabRWSet struct {
	Namespace string  `json:"namespace,omitempty"`
	Reads     []Read  `json:"reads,omitempty"`
	Writes    []Write `json:"writes,omitempty"`
}

type Network

type Network struct {
	ID       string `pg:"id,pk" json:"id"`
	Type     string `pg:"type" json:"type"`
	Platform string `pg:"platform" json:"platform"`
	Profile  []byte `pg:"profile" json:"profile,omitempty"`
	Status   Status `pg:"status" json:"status,omitempty"`
}

type Read

type Read struct {
	Key     string `json:"key,omitempty"`
	Version string `json:"version,omitempty"`
}

type Status

type Status string
const (
	Registered   Status = "Registered"
	Deregistered Status = "Deregistered"
)

type Transaction

type Transaction struct {
	ID          string `pg:"id,pk" json:"id"`
	Network     string `pg:"network" json:"network"`
	BlockNumber uint64 `pg:"blockNumber" json:"blockNumber"`
	CreatedAt   int64  `pg:"createdAt" json:"createdAt"`
	Creator     string `pg:"creator" json:"creator"`

	Type    TxType `pg:"type" json:"type"`
	Payload []byte `pg:"payload" json:"payload"`

	// EndorserTransaction
	ChaincodeID string   `pg:"chaincodeId" json:"chaincodeId"`
	Method      string   `pg:"method" json:"method"`
	Args        []string `pg:"args" json:"args"`

	ValidationCode int32 `pg:"validationCode" json:"validationCode"`
}

func (*Transaction) AfterQuery

func (*Transaction) AfterQuery(ctx context.Context, event *pg.QueryEvent) error

func (*Transaction) BeforeQuery

func (*Transaction) BeforeQuery(ctx context.Context, event *pg.QueryEvent) (context.Context, error)

type TxType

type TxType string
const (
	Config              TxType = "Config"
	ConfigUpdate        TxType = "ConfigUpdate"
	EndorserTransaction TxType = "EndorserTransaction"
)

type Write

type Write struct {
	Key      string `json:"key,omitempty"`
	Value    string `json:"value,omitempty"`
	IsDelete bool   `json:"isDelete,omitempty"`
}

Jump to

Keyboard shortcuts

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