models

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

description: sync_eth

@author: xwc1125 @date: 2020/10/05

description: sync_eth

@author: xwc1125 @date: 2020/10/05

description: sync_eth

@author: xwc1125 @date: 2020/10/05

description: sync_eth

@author: xwc1125 @date: 2020/10/05

description: sync_eth

@author: xwc1125 @date: 2020/10/05

Index

Constants

View Source
const (
	TokenETH      = 1 // eth
	TokenContract = 2 // Contract
	TokenERC20    = 3 // ERC20
	TokenDeploy   = 4 // deploy contract

	TypeAccountNormal   = 0
	TypeAccountContract = 1
)

Variables

View Source
var (
	ContractTypeUnknown = 0
	ContractTypeERC20   = 1
	ContractTypeERC721  = 2
)

Functions

This section is empty.

Types

type AccountMap

type AccountMap map[string]*Accounts

type Accounts

type Accounts struct {
	Id               int64           `json:"id"`
	Address          string          `json:"address"`
	Balance          decimal.Decimal `json:"balance"`       // balance
	BalanceInput     decimal.Decimal `json:"balanceInput"`  // input balance
	BalanceOutput    decimal.Decimal `json:"balanceOutput"` // output balance
	AccountType      int64           `json:"type"`          // 0:common,1:contract
	Contract         string          `json:"contract"`      // contract address
	ContractExist    int             `json:"contractExist"` // 0:contract is nil,1: contract is not nil
	TransactionCount int64           `json:"transactionCount"`
}

func (*Accounts) TableName

func (a *Accounts) TableName() string

type Block

type Block struct {
	BlockNumber uint64          `json:"block_number" es:"long"`
	BlockHash   string          `json:"block_hash" es:"text"`
	ParentHash  string          `json:"parent_hash" es:"text"`
	Miner       string          `json:"miner" es:"text"`
	BlockTime   uint64          `json:"block_time" es:"long"`
	BlockAward  decimal.Decimal `json:"block_award" es:"double"`
	TxCount     int             `json:"tx_count" es:"int"`
	BlockSize   uint64          `json:"block_size" es:"long"`
	Txs         []string        `json:"txs,omitempty" es:"text"`
	Timestamp   time.Time       `json:"timestamp" es:"date"`
}

func (*Block) MarshalJSON

func (a *Block) MarshalJSON() ([]byte, error)

func (*Block) String

func (a *Block) String() string

func (Block) TableName

func (a Block) TableName() string

type Contract

type Contract struct {
	Address          string          `json:"address" es:"keyword"`          // contract
	Name             string          `json:"name" es:"text"`                // contract name
	Symbol           string          `json:"symbol" es:"text"`              // contract symbol
	Creator          string          `json:"creator" es:"text"`             // creator
	Icon             string          `json:"icon" es:"text"`                // icon
	UnitLength       int64           `json:"unit_length" es:"integer"`      // unit_length
	Introduction     string          `json:"introduction" es:"text"`        // introduction
	WebSite          string          `json:"web_site" es:"text"`            // web_site
	BlockTime        uint64          `json:"block_time" es:"long"`          // block_time
	BlockNumber      uint64          `json:"block_number" es:"long"`        // block_number
	Total            decimal.Decimal `json:"total" es:"double"`             // total
	TxNum            int64           `json:"tx_num" es:"integer"`           // tx_num
	TxHash           string          `json:"tx_hash" es:"text"`             // tx_hash
	Type             int             `json:"type" es:"integer"`             // type,0:unknown,1:ERC20,2:ERC721
	AccountNum       int             `json:"account_num" es:"integer"`      // account num
	TokenCirculation decimal.Decimal `json:"token_circulation" es:"double"` // token_circulation
	TokenTxNum       int64           `json:"token_tx_num" es:"integer"`     // token_tx_num
	IsShow           bool            `json:"is_show" es:"boolean"`          // is_show
	Timestamp        time.Time       `json:"timestamp" es:"date"`           // timestamp
}

func (*Contract) Bytes

func (c *Contract) Bytes() ([]byte, error)

func (*Contract) MarshalJSON

func (a *Contract) MarshalJSON() ([]byte, error)

func (Contract) TableName

func (a Contract) TableName() string

type ContractMap

type ContractMap map[string]*Contract

type ContractMapSet

type ContractMapSet struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewContractMapSet

func NewContractMapSet() *ContractMapSet

func (*ContractMapSet) Clear

func (s *ContractMapSet) Clear()

func (*ContractMapSet) Get

func (s *ContractMapSet) Get(item string) (*Contract, bool)

func (*ContractMapSet) IsEmpty

func (s *ContractMapSet) IsEmpty() bool

func (*ContractMapSet) Len

func (s *ContractMapSet) Len() int

func (*ContractMapSet) List

func (s *ContractMapSet) List() ContractMap

func (*ContractMapSet) Remove

func (s *ContractMapSet) Remove(items ...string)

func (*ContractMapSet) SortList

func (s *ContractMapSet) SortList() []string

func (*ContractMapSet) Update

func (s *ContractMapSet) Update(items ...*Contract)

type ListenAddress

type ListenAddress struct {
	Address string `json:"address" es:"keyword"` // address
	Remark  string `json:"remark" es:"text"`     // memo
}

func (*ListenAddress) String

func (a *ListenAddress) String() string

func (ListenAddress) TableName

func (a ListenAddress) TableName() string

type MapSet

type MapSet struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewMapSet

func NewMapSet() *MapSet

func (*MapSet) Clear

func (s *MapSet) Clear()

func (*MapSet) Get

func (s *MapSet) Get(item string, contract string) (*Accounts, bool)

func (*MapSet) IsEmpty

func (s *MapSet) IsEmpty() bool

func (*MapSet) Len

func (s *MapSet) Len() int

func (*MapSet) List

func (s *MapSet) List() AccountMap

func (*MapSet) Remove

func (s *MapSet) Remove(items ...string)

func (*MapSet) SortList

func (s *MapSet) SortList() []string

func (*MapSet) Update

func (s *MapSet) Update(items ...*Accounts)

type Transaction

type Transaction struct {
	//Id       int64           `json:"id"`
	TxHash   string          `json:"tx_hash" es:"keyword"`
	From     string          `json:"from" es:"keyword"`
	To       string          `json:"to" es:"keyword"`
	Value    decimal.Decimal `json:"value" es:"double"`
	Nonce    decimal.Decimal `json:"nonce" es:"long"`
	GasPrice decimal.Decimal `json:"gas_price" es:"long"`
	GasLimit uint64          `json:"gas_limit" es:"long"`

	Contract string `json:"contract" es:"keyword"`
	TxType   int    `json:"tx_type" es:"integer"`
	Status   bool   `json:"status" es:"boolean"`

	BlockNumber      decimal.Decimal `json:"block_number" es:"long"`
	BlockTime        uint64          `json:"block_time" es:"long"`
	TransactionIndex uint64          `json:"transaction_index" es:"integer"`

	GasUsed decimal.Decimal `json:"gas_used" es:"long"`
	Fee     decimal.Decimal `json:"fee" es:"double"`

	Input     string    `json:"input" es:"input"`
	Timestamp time.Time `json:"timestamp" es:"date"`
}

func (*Transaction) MarshalJSON

func (a *Transaction) MarshalJSON() ([]byte, error)

func (Transaction) TableName

func (a Transaction) TableName() string

Jump to

Keyboard shortcuts

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