models

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NetworkStatusValid   = 1
	NetworkStatusInvalid = 2
)
View Source
const DefaultFeeTx = "default"
View Source
const VerifyCodeDuration = time.Minute
View Source
const VerifyCodeExpired = time.Minute * 15

Variables

This section is empty.

Functions

func AccountIsExist

func AccountIsExist(mail string) (bool, error)

func CreateEvidences

func CreateEvidences(chainID string, es types.EvidenceList) (err error)

func CreateGenesis

func CreateGenesis(chainId string, genesisTime time.Time, data string) error

func CreateNetworkOrUpdate

func CreateNetworkOrUpdate(chainID string, n *Network) error

func DeleteNodeByName

func DeleteNodeByName(name string) error

func DropDatabase

func DropDatabase(name string) error

DropDatabase 删除数据库

func GetNodeEngine

func GetNodeEngine(name string) (*xorm.Engine, error)

func InitDb

func InitDb(cfg *config.DBConfig) (err error)

func NewTestEngine

func NewTestEngine(cfg *config.DBConfig) (*testEngine, error)

func UpdateFee

func UpdateFee(chainID, tx, fee string, gasWanted, gasUsed int64) error

Types

type Account

type Account struct {
	Id          int64  `xorm:"pk autoincr BIGINT"`
	Mail        string `xorm:"unique"`
	Name        string `xorm:"VARCHAR(64)"`
	Avatar      string `xorm:"TEXT"`
	Description string `xorm:"TEXT"`
	Status      int    `xorm:"INTEGER"`
	Password    string `xorm:"VARCHAR(128)"`

	Version int `xorm:"version"`

	UpdatedAt     time.Time `xorm:"-"`
	UpdatedAtUnix int64
	CreatedAt     time.Time `xorm:"-"`
	CreatedAtUnix int64
}

func Accounts

func Accounts(opt *AccountOption) ([]*Account, error)

func CreateAccount

func CreateAccount(mail, password string) (*Account, error)

func RetrieveAccountByID

func RetrieveAccountByID(id int64) (*Account, error)

func RetrieveAccountByMail

func RetrieveAccountByMail(mail string) (*Account, error)

func (*Account) AfterSet

func (a *Account) AfterSet(colName string, _ xorm.Cell)

func (*Account) Apps

func (a *Account) Apps() ([]*App, error)

func (*Account) BeforeInsert

func (a *Account) BeforeInsert()

func (*Account) BeforeUpdate

func (a *Account) BeforeUpdate()

func (*Account) CheckPassword

func (a *Account) CheckPassword(pwd string) bool

func (*Account) CreateApp

func (a *Account) CreateApp(name string) (*App, error)

func (*Account) CreateSession

func (a *Account) CreateSession(loginType int, expire time.Duration) (string, error)

func (*Account) DeleteAppByID

func (a *Account) DeleteAppByID(id int64) error

func (*Account) DeleteSession

func (a *Account) DeleteSession() error

func (*Account) Insert

func (a *Account) Insert() error

func (*Account) UpdatePassword

func (a *Account) UpdatePassword(pwd string) error

func (*Account) UpdateProfile

func (a *Account) UpdateProfile(opt *AccountOption) error

type AccountOption

type AccountOption struct {
	Name          string
	Avatar        string
	Description   string
	Offset, Limit int
	// contains filtered or unexported fields
}

type Agent

type Agent struct {
	Id       int64  `xorm:"pk autoincr BIGINT"`
	NodeType string `xorm:"TEXT"`
	BaseUrl  string `xorm:"TEXT"`

	Version       int       `xorm:"version"`
	UpdatedAt     time.Time `xorm:"-"`
	UpdatedAtUnix int64
	CreatedAt     time.Time `xorm:"-"`
	CreatedAtUnix int64
}

func Agents

func Agents() ([]*Agent, error)

func AgentsByNodeType

func AgentsByNodeType(nodeType string) ([]*Agent, error)

func CreateAgent

func CreateAgent(agentType, baseURL string) (*Agent, error)

func (*Agent) AfterSet

func (n *Agent) AfterSet(colName string, _ xorm.Cell)

func (*Agent) BeforeInsert

func (n *Agent) BeforeInsert()

func (*Agent) BeforeUpdate

func (n *Agent) BeforeUpdate()

func (*Agent) Insert

func (n *Agent) Insert() error

type App

type App struct {
	Id        int64  `xorm:"pk autoincr BIGINT" json:"id"`
	Name      string `xorm:"VARCHAR(64)" json:"name"`
	SecretKey string `xorm:"unique TEXT" json:"secretKey"`
	Status    int    `xorm:"INTEGER" json:"-"`
	AccountId int64  `xorm:"index BIGINT" json:"accountId"`

	Version   int       `xorm:"version" json:"-"`
	DeletedAt time.Time `xorm:"deleted" json:"-"`

	UpdatedAt     time.Time `xorm:"-"`
	UpdatedAtUnix int64
	CreatedAt     time.Time `xorm:"-"`
	CreatedAtUnix int64
}

func AppById

func AppById(id int64) (*App, error)

func AppBySecretKey

func AppBySecretKey(secretKey string) (*App, error)

func AppsByAccount

func AppsByAccount(id int64) ([]*App, error)

func (*App) Account

func (a *App) Account() (*Account, error)

func (*App) AfterSet

func (a *App) AfterSet(colName string, _ xorm.Cell)

func (*App) BeforeInsert

func (a *App) BeforeInsert()

func (*App) BeforeUpdate

func (a *App) BeforeUpdate()

func (*App) Insert

func (a *App) Insert() error

type AtmIpRecord

type AtmIpRecord struct {
	Id      int64  `xorm:"pk autoincr BIGINT"`
	Chainid string `xorm:"-"`
	Ip      string `xorm:"unique(atm_ip_record_ip_created_at_unix) TEXT"`
	Amount  int

	Version int `xorm:"version"`

	UpdatedAt     time.Time `xorm:"-"`
	UpdatedAtUnix int64
	CreatedAt     time.Time `xorm:"-"`
	CreatedAtUnix int64     `xorm:"unique(atm_ip_record_ip_created_at_unix)"`
}

func RetrieveAtmIpRecordByIpCreateat

func RetrieveAtmIpRecordByIpCreateat(chainID string, ip string, t time.Time) (*AtmIpRecord, error)

func (*AtmIpRecord) AfterSet

func (air *AtmIpRecord) AfterSet(colName string, _ xorm.Cell)

func (*AtmIpRecord) BeforeInsert

func (air *AtmIpRecord) BeforeInsert()

func (*AtmIpRecord) BeforeUpdate

func (air *AtmIpRecord) BeforeUpdate()

func (*AtmIpRecord) Insert

func (air *AtmIpRecord) Insert(chainID string) error

func (*AtmIpRecord) Update

func (air *AtmIpRecord) Update(chainID string) error

type AtmRecord

type AtmRecord struct {
	Id       int64     `xorm:"pk autoincr BIGINT"`
	Address  string    `xorm:"unique(atm_record_address_idx)"`
	Coin     string    `xorm:"TEXT"`
	Amount   string    `xorm:"TEXT"`
	Height   int64     `xorm:"BIGINT"`
	Hash     string    `xorm:"TEXT"`
	Createat time.Time `xorm:"unique(atm_record_address_idx)"`

	Version int `xorm:"version"`

	UpdatedAt     time.Time `xorm:"-"`
	UpdatedAtUnix int64
	CreatedAt     time.Time `xorm:"-"`
	CreatedAtUnix int64
}

func RetrieveAtmRecordByAddressCreateat

func RetrieveAtmRecordByAddressCreateat(chainID string, address string, t time.Time) (*AtmRecord, error)

func (*AtmRecord) AfterSet

func (ar *AtmRecord) AfterSet(colName string, _ xorm.Cell)

func (*AtmRecord) BeforeInsert

func (ar *AtmRecord) BeforeInsert()

func (*AtmRecord) BeforeUpdate

func (ar *AtmRecord) BeforeUpdate()

func (*AtmRecord) Insert

func (ar *AtmRecord) Insert(chainID string) error

func (*AtmRecord) Update

func (ar *AtmRecord) Update(chainID string) error

type Block

type Block struct {
	Id              int64     `xorm:"pk autoincr BIGINT"`
	ChainId         string    `xorm:"-"`
	Height          int64     `xorm:"unique(blocks_height_idx) BIGINT"`
	NumTxs          int64     `xorm:"BIGINT"`
	TotalTxs        int64     `xorm:"BIGINT"`
	DataHash        string    `xorm:"TEXT"`
	ValidatorsNum   int64     `xorm:"BIGINT"`
	ValidatorsTotal int64     `xorm:"BIGINT"`
	ValidatorsHash  string    `xorm:"TEXT"`
	ProposerAddress string    `xorm:"TEXT"`
	Time            time.Time `xorm:"-"`
	TimeUnix        int64
}

func Blocks

func Blocks(chainID string, opt *BlockOption) ([]*Block, error)

func (*Block) AfterSet

func (b *Block) AfterSet(colName string, _ xorm.Cell)

func (*Block) BeforeInsert

func (b *Block) BeforeInsert()

func (*Block) BeforeUpdate

func (b *Block) BeforeUpdate()

func (*Block) Insert

func (b *Block) Insert(chainID string) error

type BlockOption

type BlockOption struct {
	MinHeight     int64
	MaxHeight     int64
	Height        int64
	NumTxs        int64
	Offset, Limit int
}

type BlockValidator

type BlockValidator struct {
	Id               int64     `xorm:"pk autoincr BIGINT"`
	ChainId          string    `xorm:"-"`
	Height           int64     `xorm:"index(block_validators_height_idx) BIGINT"`
	ValidatorAddress string    `xorm:"index TEXT"`
	ValidatorIndex   int64     `xorm:"BIGINT"`
	Type             int64     `xorm:"BIGINT"`
	Round            int64     `xorm:"BIGINT"`
	Signature        string    `xorm:"TEXT"`
	VotingPower      int64     `xorm:"BIGINT"`
	Accum            int64     `xorm:"BIGINT"`
	Time             time.Time `xorm:"-"`
	TimeUnix         int64
}

func BlockValidators

func BlockValidators(chainID string, opt *BlockValidatorOption) ([]*BlockValidator, error)

func (*BlockValidator) AfterSet

func (bv *BlockValidator) AfterSet(colName string, _ xorm.Cell)

func (*BlockValidator) BeforeInsert

func (bv *BlockValidator) BeforeInsert()

func (*BlockValidator) BeforeUpdate

func (bv *BlockValidator) BeforeUpdate()

func (*BlockValidator) Insert

func (bv *BlockValidator) Insert(chainID string) error

type BlockValidatorOption

type BlockValidatorOption struct {
	MinHeight        int64
	MaxHeight        int64
	Height           int64
	ValidatorAddress string
	Offset, Limit    int
}

type ConsensusState

type ConsensusState struct {
	Id              int64  `xorm:"pk autoincr BIGINT"`
	ChainId         string `xorm:"-"`
	Height          string `xorm:"TEXT"`
	Round           string `xorm:"TEXT"`
	Step            string `xorm:"TEXT"`
	PrevotesNum     int64  `xorm:"BIGINT"`
	PrevotesValue   string `xorm:"TEXT"`
	PrecommitsNum   int64  `xorm:"BIGINT"`
	PrecommitsValue string `xorm:"TEXT"`
	StartTime       string `xorm:"TEXT"`
}

func RetrieveConsensusState

func RetrieveConsensusState(chainID string) (*ConsensusState, error)

func (*ConsensusState) Insert

func (cs *ConsensusState) Insert(chainID string) error

func (*ConsensusState) Update

func (cs *ConsensusState) Update(chainID string) error

type Engine

type Engine interface {
	Delete(interface{}) (int64, error)
	Exec(string, ...interface{}) (sql.Result, error)
	Find(interface{}, ...interface{}) error
	Get(interface{}) (bool, error)
	ID(interface{}) *xorm.Session
	In(string, ...interface{}) *xorm.Session
	Insert(...interface{}) (int64, error)
	InsertOne(interface{}) (int64, error)
	Iterate(interface{}, xorm.IterFunc) error
	Sql(string, ...interface{}) *xorm.Session
	Table(interface{}) *xorm.Session
	Where(interface{}, ...interface{}) *xorm.Session
}

Engine represents a XORM engine or session.

type Evidence

type Evidence struct {
	Id               int64  `xorm:"pk autoincr BIGINT"`
	Height           int64  `xorm:"BIGINT"`
	ValidatorAddress string `xorm:"TEXT"`
	Hash             string `xorm:"TEXT"`
	Data             string `xorm:"TEXT"`

	CreatedAt     time.Time `xorm:"-"`
	CreatedAtUnix int64
}

func RetrieveEvidenceByHeight

func RetrieveEvidenceByHeight(chainID, validator string, height int64) (*Evidence, error)

func RetrieveEvidences

func RetrieveEvidences(chainID, validator string) ([]*Evidence, error)

func (*Evidence) AfterSet

func (n *Evidence) AfterSet(colName string, _ xorm.Cell)

func (*Evidence) BeforeInsert

func (n *Evidence) BeforeInsert()

func (*Evidence) BeforeUpdate

func (n *Evidence) BeforeUpdate()

func (*Evidence) Insert

func (n *Evidence) Insert(chainID string) error

type Fee

type Fee struct {
	Id        int64  `xorm:"pk autoincr BIGINT"`
	Tx        string `xorm:"unique(fee_tx_idx) TEXT"`
	GasWanted int64  `xorm:"BIGINT"`
	GasUsed   int64  `xorm:"BIGINT"`
	Fee       string `xorm:"TEXT"`
	ChainID   string `xorm:"-"`

	Version       int       `xorm:"version"`
	UpdatedAt     time.Time `xorm:"-"`
	UpdatedAtUnix int64
	CreatedAt     time.Time `xorm:"-"`
	CreatedAtUnix int64
}

func RetrieveFeeByTx

func RetrieveFeeByTx(chainID, tx string) (*Fee, error)

func (*Fee) AfterSet

func (n *Fee) AfterSet(colName string, _ xorm.Cell)

func (*Fee) BeforeInsert

func (n *Fee) BeforeInsert()

func (*Fee) BeforeUpdate

func (n *Fee) BeforeUpdate()

func (*Fee) Insert

func (n *Fee) Insert(chainID string) error

type Genesis

type Genesis struct {
	Id              int64     `xorm:"pk autoincr BIGINT"`
	ChainId         string    `xorm:"-"`
	GenesisTime     time.Time `xorm:"-"`
	GenesisTimeUnix int64
	Data            string `xorm:"TEXT"`
}

func RetrieveGenesis

func RetrieveGenesis(chainId string) (*Genesis, error)

func (*Genesis) AfterSet

func (g *Genesis) AfterSet(colName string, _ xorm.Cell)

func (*Genesis) BeforeInsert

func (g *Genesis) BeforeInsert()

func (*Genesis) BeforeUpdate

func (g *Genesis) BeforeUpdate()

func (*Genesis) Insert

func (g *Genesis) Insert(chainID string) error

type LoginStatus

type LoginStatus struct {
	Id            int64  `xorm:"pk autoincr BIGINT"`
	AccountId     int64  `xorm:"unique BIGINT"`
	LoginType     int    `xorm:"default 0 SMALLINT"`
	Token         string `xorm:"unique VARCHAR(64)"`
	ExpiredAtUnix int64

	Version int `xorm:"version"`

	UpdatedAt     time.Time `xorm:"-"`
	UpdatedAtUnix int64
	CreatedAt     time.Time `xorm:"-"`
	CreatedAtUnix int64
}

func LoginStatusByAccountID

func LoginStatusByAccountID(id int64) (*LoginStatus, error)

func LoginStatusByLoginStatusByToken

func LoginStatusByLoginStatusByToken(token string) (*LoginStatus, error)

func (*LoginStatus) Account

func (ls *LoginStatus) Account() (*Account, error)

func (*LoginStatus) AfterSet

func (ls *LoginStatus) AfterSet(colName string, _ xorm.Cell)

func (*LoginStatus) BeforeInsert

func (ls *LoginStatus) BeforeInsert()

func (*LoginStatus) BeforeUpdate

func (ls *LoginStatus) BeforeUpdate()

func (*LoginStatus) Insert

func (ls *LoginStatus) Insert(chainID string) error

type Missing

type Missing struct {
	Id               int64  `xorm:"pk autoincr BIGINT"`
	ValidatorAddress string `xorm:"TEXT"`
	Height           int64  `xorm:"BIGINT"`

	CreatedAt     time.Time `xorm:"-"`
	CreatedAtUnix int64
}

func RetrieveMissings

func RetrieveMissings(chainID, validator string) ([]*Missing, error)

func (*Missing) AfterSet

func (n *Missing) AfterSet(colName string, _ xorm.Cell)

func (*Missing) BeforeInsert

func (n *Missing) BeforeInsert()

func (*Missing) BeforeUpdate

func (n *Missing) BeforeUpdate()

func (*Missing) Insert

func (n *Missing) Insert(chainID string) error

type Network

type Network struct {
	ID     int64  `json:"id"`
	Remote string `json:"remote"`
	Delay  int64  `json:"delay"`
	Status int    `json:"status"` // 1: 有效  2: 无效

	LastTestAt     time.Time `xorm:"-"`
	LastTestAtUnix int64

	CreatedAt     time.Time `xorm:"-"`
	CreatedAtUnix int64
}

func Networks

func Networks(chainID string, opt *NetworkOption) ([]*Network, error)

func (*Network) AfterSet

func (n *Network) AfterSet(colName string, _ xorm.Cell)

func (*Network) BeforeInsert

func (n *Network) BeforeInsert()

func (*Network) BeforeUpdate

func (n *Network) BeforeUpdate()

func (*Network) Check

func (n *Network) Check()

func (*Network) InsertOrUpdate

func (n *Network) InsertOrUpdate(chainID string) error

type NetworkOption

type NetworkOption struct {
	Status        int
	Offset, Limit int
}

type Node

type Node struct {
	Id          int64  `xorm:"pk autoincr BIGINT"`
	Name        string `xorm:"unique VARCHAR(128)"`
	BaseUrl     string `xorm:"TEXT"`
	SecretKey   string `xorm:"TEXT"`
	ChainId     string `xorm:"TEXT"`
	NodeType    string `xorm:"TEXT"`
	NodeVersion string `xorm:"TEXT"`
	Sort        int

	Version       int       `xorm:"version"`
	UpdatedAt     time.Time `xorm:"-"`
	UpdatedAtUnix int64
	CreatedAt     time.Time `xorm:"-"`
	CreatedAtUnix int64
}

func CreateNode

func CreateNode(name, baseURL, nodeType, nodeVersion, secretKey, chainID string) (*Node, error)

func Nodes

func Nodes() ([]*Node, error)

func RetrieveNodeByName

func RetrieveNodeByName(name string) (*Node, error)

func (*Node) AfterSet

func (n *Node) AfterSet(colName string, _ xorm.Cell)

func (*Node) BeforeInsert

func (n *Node) BeforeInsert()

func (*Node) BeforeUpdate

func (n *Node) BeforeUpdate()

func (*Node) Insert

func (n *Node) Insert() error

type NodeRoute

type NodeRoute struct {
	Id     int64  `xorm:"pk autoincr BIGINT"`
	NodeId int64  `xorm:"index BIGINT"`
	Route  string `xorm:"VARCHAR(64)"`
	Hidden bool   `xorm:"default false BOOL"`
}

type Peer

type Peer struct {
	ID            int64     `json:"id"`
	ChainID       string    `json:"chain_id"`
	Moniker       string    `json:"moniker"`
	PeerID        string    `xorm:"unique" json:"peer_id"`
	ListenAddr    string    `json:"listen_addr"`
	Network       string    `json:"network"`
	Version       string    `json:"version"`
	Channels      string    `json:"channels"`
	SendStart     time.Time `xorm:"-" json:"send_start"`
	SendStartUnix int64
	RecvStart     time.Time `xorm:"-" json:"recv_start"`
	RecvStartUnix int64
}

func Peers

func Peers(chainID string, opt *PeerOption) ([]*Peer, error)

func (*Peer) AfterSet

func (p *Peer) AfterSet(colName string, _ xorm.Cell)

func (*Peer) BeforeInsert

func (p *Peer) BeforeInsert()

func (*Peer) BeforeUpdate

func (p *Peer) BeforeUpdate()

func (*Peer) Insert

func (p *Peer) Insert(chainID string) error

type PeerOption

type PeerOption struct {
	Offset, Limit int
}

type Proposal added in v0.0.6

type Proposal struct {
	Id              int64     `xorm:"pk autoincr BIGINT"`
	ProposalID      int64     `xorm:"BIGINT"`
	Title           string    `xorm:"unique(title_tx_idx) TEXT"`
	Description     string    `xorm:"TEXT"`
	Type            string    `xorm:"TEXT"`
	Status          string    `xorm:"TEXT"`
	SubmitTime      time.Time `xorm:"-"`
	VotingStartTime time.Time `xorm:"-"`
	TotalDeposit    int64     `xorm:"BIGINT"`
	ChainID         string    `xorm:"-"`
	UpdatedAt       time.Time `xorm:"-"`
	UpdatedAtUnix   int64
	CreatedAt       time.Time `xorm:"-"`
	CreatedAtUnix   int64
}

func Proposals added in v0.0.6

func Proposals(chainID string) ([]*Proposal, error)

func (*Proposal) AfterSet added in v0.0.6

func (n *Proposal) AfterSet(colName string, _ xorm.Cell)

func (*Proposal) BeforeInsert added in v0.0.6

func (n *Proposal) BeforeInsert()

func (*Proposal) BeforeUpdate added in v0.0.6

func (n *Proposal) BeforeUpdate()

func (*Proposal) Insert added in v0.0.6

func (n *Proposal) Insert(chainID string) error

func (*Proposal) Update added in v0.0.6

func (pro *Proposal) Update(chainID string) error

func (*Proposal) UpdateStatus added in v0.0.6

func (pro *Proposal) UpdateStatus(chainID string) error

type QmoonStatus

type QmoonStatus struct {
	Id    int64  `xorm:"pk autoincr BIGINT"`
	Key   string `xorm:"unique VARCHAR(64)"`
	Value string `xorm:"TEXT"`

	Version       int       `xorm:"version"`
	UpdatedAt     time.Time `xorm:"-"`
	UpdatedAtUnix int64
	CreatedAt     time.Time `xorm:"-"`
	CreatedAtUnix int64
}

func RetrieveQmoonStatusByKey

func RetrieveQmoonStatusByKey(key string) (*QmoonStatus, error)

func (*QmoonStatus) AfterSet

func (qs *QmoonStatus) AfterSet(colName string, _ xorm.Cell)

func (*QmoonStatus) BeforeInsert

func (qs *QmoonStatus) BeforeInsert()

func (*QmoonStatus) BeforeUpdate

func (qs *QmoonStatus) BeforeUpdate()

func (*QmoonStatus) Insert

func (qs *QmoonStatus) Insert() error

func (*QmoonStatus) Update

func (qs *QmoonStatus) Update() error

type TmBlock

type TmBlock struct {
	Id     int64  `xorm:"pk autoincr BIGINT"`
	Height int64  `xorm:"unique(tm_blocks_height_idx) BIGINT"`
	Data   string `xorm:"TEXT"`
}

func (*TmBlock) Insert

func (tb *TmBlock) Insert(chainID string) error

type Tx

type Tx struct {
	Id          int64  `xorm:"pk autoincr BIGINT"`
	ChainId     string `xorm:"-"`
	Height      int64  `xorm:"index(txs_height_idx) unique(txs_height_index_idx) BIGINT"`
	TxType      string `xorm:"TEXT"`
	Index       int64  `xorm:"unique(txs_height_index_idx) BIGINT"`
	Hash        string
	Maxgas      int64 `xorm:"BIGINT"`
	GasWanted   int64
	Fee         string
	GasUsed     int64
	QcpFrom     string    `xorm:"TEXT"`
	QcpTo       string    `xorm:"TEXT"`
	QcpSequence int64     `xorm:"BIGINT"`
	QcpTxindex  int64     `xorm:"BIGINT"`
	QcpIsresult bool      `xorm:"BOOL"`
	TxStatus    int       `xorm:"default 0 INTEGER"`
	OriginTx    string    `xorm:"TEXT"`
	JsonTx      string    `xorm:"TEXT"`
	Log         string    `xorm:"TEXT"`
	Time        time.Time `xorm:"-"`
	TimeUnix    int64
}

func TxByHash

func TxByHash(chainID string, hash string) (*Tx, error)

func TxByHeightIndex

func TxByHeightIndex(chainID string, height, index int64) (*Tx, error)

func Txs

func Txs(chainID string, opt *TxOption) ([]*Tx, error)

func (*Tx) AfterSet

func (t *Tx) AfterSet(colName string, _ xorm.Cell)

func (*Tx) BeforeInsert

func (t *Tx) BeforeInsert()

func (*Tx) BeforeUpdate

func (t *Tx) BeforeUpdate()

func (*Tx) Insert

func (t *Tx) Insert(chainID string) error

type TxOption

type TxOption struct {
	TxType        string
	MinHeight     int64
	MaxHeight     int64
	Address       string
	Offset, Limit int
}

type TxTransfer

type TxTransfer struct {
	Id        int64     `xorm:"pk autoincr BIGINT"`
	ChainId   string    `xorm:"-"`
	Height    int64     `xorm:"BIGINT"`
	Hash      string    `xorm:"TEXT"`
	Address   string    `xorm:"index TEXT"`
	Coin      string    `xorm:"TEXT"`
	Amount    string    `xorm:"TEXT"`
	TxStatus  int       `xorm:"default 0 INTEGER"`
	IsMulti   bool      `xorm:"default false BOOL"`
	MultiData string    `xorm:"TEXT"`
	Type      int       `xorm:"SMALLINT"`
	Time      time.Time `xorm:"-"`
	TimeUnix  int64
}

func TxTransfers

func TxTransfers(chainID string, opt *TxTransferOption) ([]*TxTransfer, error)

func (*TxTransfer) AfterSet

func (tt *TxTransfer) AfterSet(colName string, _ xorm.Cell)

func (*TxTransfer) BeforeInsert

func (tt *TxTransfer) BeforeInsert()

func (*TxTransfer) BeforeUpdate

func (tt *TxTransfer) BeforeUpdate()

func (*TxTransfer) Insert

func (tt *TxTransfer) Insert(chainID string) error

type TxTransferOption

type TxTransferOption struct {
	Address       string
	Coin          string
	Offset, Limit int
}

type Validator

type Validator struct {
	Id                 int64  `xorm:"pk autoincr BIGINT"`
	Name               string `xorm:"TEXT"`
	Details            string `xorm:"TEXT"`
	Identity           string `xorm:"TEXT"`
	Website            string    `xorm:"TEXT"`
	Owner              string    `xorm:"TEXT"`
	ChainId            string    `xorm:"-"`
	Address            string    `xorm:"unique TEXT"`
	PubKeyType         string    `xorm:"TEXT"`
	PubKeyValue        string    `xorm:"TEXT"`
	Commission         string    `xorm:"TEXT"`
	VotingPower        int64     `xorm:"BIGINT"`
	Accum              int64     `xorm:"BIGINT"`
	FirstBlockHeight   int64     `xorm:"BIGINT"`
	FirstBlockTime     time.Time `xorm:"-"`
	FirstBlockTimeUnix int64
	Status             int       `xorm:"INTEGER"`
	InactiveCode       int       `xorm:"INTEGER"`
	InactiveTime       time.Time `xorm:"-"`
	InactiveTimeUnix   int64
	InactiveHeight     int64 `xorm:"BIGINT"`
	BondHeight         int64 `xorm:"BIGINT"`
	PrecommitNum       int64
}

func ValidatorByAddress

func ValidatorByAddress(chainID, address string) (*Validator, error)

func Validators

func Validators(chainID string) ([]*Validator, error)

func (*Validator) AfterSet

func (val *Validator) AfterSet(colName string, _ xorm.Cell)

func (*Validator) BeforeInsert

func (val *Validator) BeforeInsert()

func (*Validator) BeforeUpdate

func (val *Validator) BeforeUpdate()

func (*Validator) Insert

func (val *Validator) Insert(chainID string) error

func (*Validator) Update

func (val *Validator) Update(chainID string) error

func (*Validator) UpdateStatus

func (val *Validator) UpdateStatus(chainID string) error

type VerifyCode

type VerifyCode struct {
	Id    int64  `xorm:"pk autoincr BIGINT"`
	Email string `xorm:"unique TEXT"`
	Code  string `xorm:"TEXT"`

	Version       int       `xorm:"version"`
	CreatedAt     time.Time `xorm:"-"`
	CreatedAtUnix int64
}

func CreateVerifyCode

func CreateVerifyCode(email, code string) (*VerifyCode, error)

func VerifyCodeByEmail

func VerifyCodeByEmail(email string) (*VerifyCode, error)

func (*VerifyCode) AfterSet

func (vc *VerifyCode) AfterSet(colName string, _ xorm.Cell)

func (*VerifyCode) BeforeInsert

func (vc *VerifyCode) BeforeInsert()

func (*VerifyCode) BeforeUpdate

func (vc *VerifyCode) BeforeUpdate()

func (*VerifyCode) Delete

func (vc *VerifyCode) Delete() error

func (*VerifyCode) Insert

func (vc *VerifyCode) Insert() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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