model

package
v0.0.0-...-58a2b35 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Success   = 2000 //成功
	NoMethod  = 4001 //没有这个方法
	TypeWrong = 5001 //参数类型错误
	NoField   = 5002 //缺少参数
	Nomarl    = 5003 //一般错误,请看错误提示信息
	Timeout   = 5004 //超时
	Exist     = 5005 //已经存在
	FailPwd   = 5006 //密码错误
	NotExist  = 5007 //不存在
)

Variables

This section is empty.

Functions

func Errcode

func Errcode(code int, p ...string) (res []byte, err error)

func RegisterErrcode

func RegisterErrcode(code int, message string)

func Tojson

func Tojson(data interface{}) ([]byte, error)

Types

type GetAccount

type GetAccount struct {
	Balance       uint64 `json:"Balance"`
	BalanceFrozen uint64 `json:"BalanceFrozen"`
}

帐号余额

type GetNewAddress

type GetNewAddress struct {
	Address string `json:"address"`
}

新地址

type Getinfo

type Getinfo struct {
	Netid          []byte `json:"netid"`          //网络版本号
	TotalAmount    uint64 `json:"TotalAmount"`    //发行总量
	Balance        uint64 `json:"balance"`        //可用余额
	BalanceFrozen  uint64 `json:"BalanceFrozen"`  //冻结的余额
	BalanceLockup  uint64 `json:"BalanceLockup"`  //锁仓的余额
	Testnet        bool   `json:"testnet"`        //是否是测试网络
	Blocks         uint64 `json:"blocks"`         //已经同步到的区块高度
	Group          uint64 `json:"group"`          //区块组高度
	StartingBlock  uint64 `json:"StartingBlock"`  //区块开始高度
	StartBlockTime uint64 `json:"StartBlockTime"` //创始区块出块时间
	HighestBlock   uint64 `json:"HighestBlock"`   //所链接的节点的最高高度
	CurrentBlock   uint64 `json:"CurrentBlock"`   //已经同步到的区块高度
	PulledStates   uint64 `json:"PulledStates"`   //正在同步的区块高度
	BlockTime      uint64 `json:"BlockTime"`      //出块时间
	LightNode      uint64 `json:"LightNode"`      //轻节点押金数量
	CommunityNode  uint64 `json:"CommunityNode"`  //社区节点押金数量
	WitnessNode    uint64 `json:"WitnessNode"`    //见证人押金数量
	NameDepositMin uint64 `json:"NameDepositMin"` //域名押金最少金额
	AddrPre        string `json:"AddrPre"`        //地址前缀
}

详情

type Result

type Result struct {
	Result interface{} `json:"result"`
}

统一输出结构

type RpcHandler

type RpcHandler interface {
	SetBody(data []byte)
	GetBody() []byte
	Out(data []byte)
	Err(code, data string)
	Validate() (msg string, ok bool)
}

type RpcJson

type RpcJson struct {
	Method string                 `json:"method"`
	Params map[string]interface{} `json:"params"`
}

func (*RpcJson) Get

func (rj *RpcJson) Get(key string) (interface{}, bool)

func (*RpcJson) Type

func (rj *RpcJson) Type(key string) string

func (*RpcJson) VerifyExistMust

func (this *RpcJson) VerifyExistMust(key, types string) (res []byte, err error, itr interface{})

验证必须存在

func (*RpcJson) VerifyExistOptional

func (this *RpcJson) VerifyExistOptional(key, types string) (res []byte, err error, itr interface{})

验证可选存在

func (*RpcJson) VerifyType

func (rj *RpcJson) VerifyType(key, types string) bool

Jump to

Keyboard shortcuts

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