db

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenX    = "nft"
	TransferX = "nft_transfer"
	AccountX  = "nft_account"
)

token db

View Source
const AccountMapping = `` /* 400-byte string literal not displayed */
View Source
const TokenMapping = `` /* 1370-byte string literal not displayed */

TokenMapping mapping nolint

View Source
const TransferMapping = `` /* 401-byte string literal not displayed */

Variables

This section is empty.

Functions

func NewAccountKey

func NewAccountKey(id string) *db.IKey

func NewTokenKey

func NewTokenKey(id string) *db.IKey

NewTokenKey NewTokenKey

func NewTransferKey

func NewTransferKey(id string) *db.IKey

func TokenID

func TokenID(contractAddr, ownerAddr string, goodsID int64) string

Types

type Account

type Account struct {
	OwnerAddr string `json:"owner_addr"`
	LabelID   string `json:"label_id"`
	GoodsID   int64  `json:"goods_id"`
	Balance   int64  `json:"balance"`
	EvmState
}

func (*Account) Key

func (acc *Account) Key() string

Key for account index id

type AccountBalance

type AccountBalance struct {
	Account pcom.Hash160Address `json:"account"`
	GoodsID int64               `json:"goodsID"`
	Balance int64               `json:"balance"`
}

AccountBalance 账户余额event结构 由于使用时是数组形式,所以地址类型没有被解析成字符串

func (AccountBalance) GetAccount

func (ab AccountBalance) GetAccount(info map[string]interface{}) *Account

type AddNewGoodsResult

type AddNewGoodsResult struct {
	Owner            string   `json:"owner"`
	GoodsID          int64    `json:"goodsID"`
	Amount           int64    `json:"amount"`
	GoodsType        int32    `json:"goodsType"`
	PublishTime      int64    `json:"publishTime"`
	Hash             []string `json:"hash"`
	Source           []string `json:"source"`
	Publisher        string   `json:"publisher"`
	Name             string   `json:"name"`
	LabelID          string   `json:"labelID"`
	Remark           string   `json:"remark"`
	Operator         string   `json:"operator"`
	PublisherAddress string   `json:"publisherAddress"`
	BatchNumber      string   `json:"batchNumber"`
	Image            string   `json:"image"`
	TraceHash        string   `json:"traceHash"`
	IsUsed           bool     `json:"isUsed"`
}

AddNewGoodsResult 发行event结构

func NewAddNewGoodsResult

func NewAddNewGoodsResult(m map[string]interface{}) (*AddNewGoodsResult, error)

func (AddNewGoodsResult) GetToken

func (r AddNewGoodsResult) GetToken(info map[string]interface{}) *Token

type BatchAddNewGoodsResult

type BatchAddNewGoodsResult struct {
	Owner       string   `json:"owner"`
	GoodsID     []int64  `json:"goodsIDs"`
	Amount      []int64  `json:"amounts"`
	GoodsType   int32    `json:"goodsType"`
	PublishTime int64    `json:"publishTime"`
	Hash        []string `json:"hash"`
	Source      []string `json:"source"`
	Publisher   string   `json:"publisher"`
	Name        []string `json:"names"`
	LabelID     []string `json:"labelIDs"`
	Remark      []string `json:"remarks"`
	Results     []*AddNewGoodsResult
}

func NewBatchAddNewGoodsResult

func NewBatchAddNewGoodsResult(m map[string]interface{}) (*BatchAddNewGoodsResult, error)

type EvmState

type EvmState struct {
	ContractAddr string `json:"contract_addr,omitempty"`
	TxHash       string `json:"evm_tx_hash,omitempty"`
	HeightIndex  int64  `json:"evm_height_index,omitempty"`
	Height       int64  `json:"evm_height,omitempty"`
	BlockHash    string `json:"evm_block_hash,omitempty"`
	BlockTime    int64  `json:"evm_block_time,omitempty"`
}

func (*EvmState) GetEvmState

func (e *EvmState) GetEvmState(m map[string]interface{})

type GoodsUsedResult

type GoodsUsedResult struct {
	From    string `json:"from"`
	To      string `json:"to"`
	GoodsID int64  `json:"id"`
	Code    string `json:"code"`
	IsUsed  bool   `json:"isUsed"`
}

GoodsUsedResult 货物领取event结构

func NewGoodsUsedResult

func NewGoodsUsedResult(m map[string]interface{}) (*GoodsUsedResult, error)

type MintGoodsResult

type MintGoodsResult struct {
	AddNewGoodsResult
	Owner            *pcom.Hash160Address `json:"owner"`
	Operator         *pcom.Hash160Address `json:"operator"`
	PublisherAddress *pcom.Hash160Address `json:"publisherAddress"`
}

MintGoodsResult 批量发行event结构,由于使用时是数组形式,所以地址类型没有被解析成字符串

func NewMintGoodsResults

func NewMintGoodsResults(m interface{}) ([]MintGoodsResult, error)

func (MintGoodsResult) GetToken

func (r MintGoodsResult) GetToken(info map[string]interface{}) *Token

type RecordAccount

type RecordAccount struct {
	*db.IKey
	*db.Op
	// contains filtered or unexported fields
}

RecordAccount db account

func NewRecordAccount

func NewRecordAccount(acc *Account, op int) *RecordAccount

func (*RecordAccount) Value

func (r *RecordAccount) Value() []byte

Value impl

type RecordToken

type RecordToken struct {
	*db.IKey
	*db.Op
	// contains filtered or unexported fields
}

RecordToken db token

func NewRecordToken

func NewRecordToken(token *Token, op int) *RecordToken

func (*RecordToken) Value

func (r *RecordToken) Value() []byte

Value impl

type RecordTransfer

type RecordTransfer struct {
	*db.IKey
	*db.Op
	// contains filtered or unexported fields
}

RecordTransfer db token

func NewRecordTransfer

func NewRecordTransfer(transfer *Transfer, op int) *RecordTransfer

func (*RecordTransfer) Value

func (r *RecordTransfer) Value() []byte

Value impl

type Token

type Token struct {
	Owner            string   `json:"owner,omitempty"`
	GoodsID          int64    `json:"goods_id"`
	Amount           int64    `json:"amount"`
	GoodsType        int32    `json:"goods_type"`
	PublishTime      int64    `json:"publish_time"`
	Hash             []string `json:"trace_hash"`
	Source           []string `json:"source_hash,omitempty"`
	Publisher        string   `json:"publisher"`
	PublisherAddress string   `json:"publisher_address"`
	Name             string   `json:"name"`
	LabelID          string   `json:"label_id"`
	Remark           string   `json:"remark,omitempty"`
	FileURL          string   `json:"file_url"`
	FileType         string   `json:"file_type"`
	Operator         string   `json:"operator"`               // 操作者
	BatchNumber      string   `json:"batch_number,omitempty"` // 批次号
	Image            string   `json:"image,omitempty"`
	IsUsed           bool     `json:"is_used"`                  // 使用标志
	UseTime          int64    `json:"use_time,omitempty"`       // 使用时间
	UserAddr         string   `json:"user_addr,omitempty"`      // 使用人地址
	UserName         string   `json:"user_name,omitempty"`      // 使用人名称
	UserRealName     string   `json:"user_real_name,omitempty"` // 使用人真实名称
	UseCode          string   `json:"use_code,omitempty"`       // 使用的验证码
	TokenType        string   `json:"token_type"`
	EvmState
}

func (*Token) Key

func (t *Token) Key() string

func (*Token) Process

func (t *Token) Process()

type TokenDB

type TokenDB interface {
	GetToken(contractAddr, ownerAddr string, goodsID int64) (*Token, error)
	GetTokens(contractAddr string, goodsID int64) ([]*Token, error)
	GetNft(contractAddr string, goodsID int64) (*Token, error)
}

func NewTokenDB

func NewTokenDB(db db.WrapDB) TokenDB

NewTokenDB NewTokenDB

type TokenRemark

type TokenRemark struct {
	FileType string `json:"file_type"`
	FileURL  string `json:"file_url"`
}

TokenRemark 合约备注信息

type Transfer

type Transfer struct {
	From         string   `json:"from"`
	FromName     string   `json:"from_name"`
	FromRealName string   `json:"from_real_name"`
	FromUserName string   `json:"from_user_name"`
	To           string   `json:"to"`
	ToName       string   `json:"to_name"`
	ToRealName   string   `json:"to_real_name"`
	ToUserName   string   `json:"to_user_name"`
	IDs          []string `json:"ids"`
	Amounts      []int64  `json:"amounts"`
	Data         []byte   `json:"data"`
	EvmState
}

func NewTransfer

func NewTransfer(event, info map[string]interface{}, confDb proofconfig.ConfigDB) (*Transfer, error)

func (*Transfer) Key

func (transfer *Transfer) Key() string

Key for transfer index id

Jump to

Keyboard shortcuts

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