storage

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	BlockNum       int    `json:"block_num"`
	BlockTimestamp int    `json:"block_timestamp"`
	Hash           string `json:"hash"`
	SpecVersion    int    `json:"spec_version"`
	Validator      string `json:"validator"`
	Finalized      bool   `json:"finalized"`
}

type DB

type DB interface {
	// Can query database all tables data
	// Query ** no prefix ** table default, option PluginPrefix can specify other plugin model
	FindBy(record interface{}, query interface{}, option *Option) (int, bool)

	// Allow to find the total numbers of elements
	CountBy(record interface{}, query interface{}) int

	// Only can exec plugin relate tables
	// Migration
	AutoMigration(model interface{}) error
	// Add column Index
	AddIndex(model interface{}, indexName string, columns ...string) error
	// Add column unique index
	AddUniqueIndex(model interface{}, indexName string, columns ...string) error

	// Create one record
	Create(record interface{}) error
	// Update one or more column
	Update(model interface{}, query interface{}, attr map[string]interface{}) error
	// Delete one or more record
	Delete(model interface{}, query interface{}) error
}

DB interface Every query can be found here https://gorm.io/docs/

type Dao

type Dao interface {
	DB
	// Find spec metadata raw
	SpecialMetadata(int) string

	// Substrate websocket rpc pool
	RPCPool() *websocket.PoolConn

	// Plugin set prefix
	SetPrefix(string)
}

type Event

type Event struct {
	BlockNum      int    `json:"block_num"`
	ExtrinsicIdx  int    `json:"extrinsic_idx"`
	ModuleId      string `json:"module_id"`
	EventId       string `json:"event_id"`
	Params        []byte `json:"params"`
	ExtrinsicHash string `json:"extrinsic_hash"`
	EventIdx      int    `json:"event_idx"`
}

type EventParam

type EventParam struct {
	Type  string      `json:"type"`
	Value interface{} `json:"value"`
}

type Extrinsic

type Extrinsic struct {
	ExtrinsicIndex     string          `json:"extrinsic_index" `
	CallCode           string          `json:"call_code"`
	CallModuleFunction string          `json:"call_module_function" `
	CallModule         string          `json:"call_module"`
	Params             []byte          `json:"params"`
	AccountId          string          `json:"account_id"`
	Signature          string          `json:"signature"`
	Nonce              int             `json:"nonce"`
	Era                string          `json:"era"`
	ExtrinsicHash      string          `json:"extrinsic_hash"`
	Success            bool            `json:"success"`
	Fee                decimal.Decimal `json:"fee"`
}

type ExtrinsicParam

type ExtrinsicParam struct {
	Name  string      `json:"name"`
	Type  string      `json:"type"`
	Value interface{} `json:"value"`
}

type Option

type Option struct {
	PluginPrefix string
	PageSize     int
	Page         int
	Order        string
}

Jump to

Keyboard shortcuts

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