bean

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockRo

type BlockRo struct {
	Number uint64 `query:"number" json:"number" validate:"omitempty"`
	Hash   string `query:"hash" json:"hash" validate:"omitempty"`
}

type Event

type Event map[string]interface{}

type EventListRo

type EventListRo struct {
	TaskId  uint      `query:"taskId" json:"taskId" validate:"required,gt=0"`
	Event   string    `query:"event" json:"event" validate:"required,gt=0"`
	Cols    []string  `query:"cols" json:"cols" validate:"omitempty"`
	Wheres  [][]Where `query:"wheres" json:"wheres" validate:"omitempty"`
	BlockRo *BlockRo  `query:"blockRo" json:"blockRo" validate:"omitempty"`
	TxRo    *TxRo     `query:"txRo" json:"txRo" validate:"omitempty"`
	TimeRo  *TimeRo   `query:"timeRo" json:"timeRo" validate:"omitempty"`
	OrderRo *OrderRo  `query:"orderRo" json:"orderRo" validate:"omitempty"`
	PageRo  *PageRo   `query:"pageRo" json:"pageRo" validate:"omitempty"`
}

type OrderRo

type OrderRo struct {
	OrderType string   `query:"orderType" json:"orderType" validate:"omitempty,oneof=ASC DESC"`
	Feilds    []string `query:"feilds" json:"feilds" validate:"omitempty"`
}

type PageRo

type PageRo struct {
	Cursor uint64 `query:"cursor" validate:"omitempty"`
	Limit  uint64 `query:"limit" validate:"required,lte=100,gte=1"`
}

type Resp

type Resp struct {
	Code    int         `json:"code"`
	Msg     string      `json:"msg"`
	Data    interface{} `json:"data"`
	TraceId string      `json:"traceId,omitempty"`
}

Resp http resp

func (*Resp) Fail

func (r *Resp) Fail(code int, desc string, result interface{}) *Resp

Fail display fail signal

func (*Resp) FailErr

func (r *Resp) FailErr(c echo.Context, err error) *Resp

func (*Resp) FailMsg

func (r *Resp) FailMsg(desc string) *Resp

FailMsg display fail msg

func (*Resp) Success

func (r *Resp) Success(result interface{}) *Resp

Success display successful signal

func (*Resp) SuccessPage

func (r *Resp) SuccessPage(content interface{}, total int64) *Resp

SuccessPage display successful result with page info

type ResultPage

type ResultPage struct {
	Items interface{} `json:"items"`
	Total int64       `json:"total"`
}

ResultPage result with page info

type TaskAddRo

type TaskAddRo struct {
	Contract string `query:"contract" validate:"required,len=42,startswith=0x"`
	Abi      string `query:"abi" validate:"required"`
	ChainId  uint64 `query:"chainId" validate:"required,gt=0"`
	Rpc      string `query:"rpc" validate:"required"`
	// 开始区块,建议是合约部署时区块号
	Start uint64 `query:"start" validate:"required,gt=0"`
	// 轮询间隔,建议为区块出块间隔,例如:ethereum 12sec,BSC 3sec
	Interval uint64 `query:"interval" validate:"required,gt=0"`
}

type TaskDeleteRo

type TaskDeleteRo struct {
	Id uint `json:"id" validate:"required,gt=0"`
}

type TaskListRo added in v0.3.1

type TaskListRo struct {
	PageRo
	Id       uint   `query:"id" validate:"omitempty,gt=0"`
	Contract string `query:"contract" validate:"omitempty,len=42,startswith=0x"`
}

type TaskPauseRo

type TaskPauseRo struct {
	Id uint `json:"id" validate:"required,gt=0"`
	// 0-默认 1-暂停
	Pause uint `json:"pause" validate:"omitempty"`
}

type TaskUpdateRo

type TaskUpdateRo struct {
	Id  uint   `json:"id" validate:"required,gt=0"`
	Rpc string `query:"rpc" validate:"required"`
}

type TimeRo

type TimeRo struct {
	Begin int64 `query:"begin" json:"begin" validate:"omitempty"`
	End   int64 `query:"end" json:"end" validate:"omitempty"`
}

type TxRo

type TxRo struct {
	Hash string `query:"hash" json:"hash" validate:"omitempty"`
}

type Where

type Where struct {
	Name  string      `query:"name" json:"name" validate:"omitempty"`
	Value interface{} `query:"value" json:"value" validate:"omitempty"`
	Op    string      `query:"op" json:"op" validate:"omitempty" default:"="` // can be =、>、<、<> and any operator supported by sql-database
}

Jump to

Keyboard shortcuts

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