corehttp

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

README

SS58AuthData

format:

发起请求时,在header中增加SS58AuthData字段,格式如下:

SS58地址:原始数据:签名后的数据的十六进制表示

example:

SS58AuthData: 5HpGQhD72vZGgAFMMiCDY61mHYtANs6B4kZXrpptGm276KnT:hello:b2146a773345dce02a4c7c7416a9b215d19157842f427f6ad991e3f40e24271add31cecc28c6d8a610a0c1cb74e24b6218c7139345ee57b5b7fbd1ba96fb6688

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenWeb added in v1.3.0

func OpenWeb(port int) error

func SS58AuthMiddleware added in v1.3.0

func SS58AuthMiddleware(c *MyContext)

func StartApi

func StartApi(ctx *context.CoreContext) error

Types

type AddDuration added in v1.1.0

type AddDuration struct {
	Duration uint16 `json:"duration"`
}

type BootParam added in v1.1.0

type BootParam struct {
	Option bool `json:"option"`
}

type ChangePrice added in v1.1.0

type ChangePrice struct {
	Price uint64 `json:"price"`
}

type HandlerFunc

type HandlerFunc func(c *MyContext)

type Keys

type Keys struct {
	PublicKey string `json:"public_key"`
}

type MyContext

type MyContext struct {
	*gin.Context
	CoreContext *context.CoreContext
}

MyContext extend gin.Context

type MyRouterGroup

type MyRouterGroup struct {
	*gin.RouterGroup
	CoreContext *context.CoreContext
}

MyRouterGroup extend gin.RouterGroup

func (*MyRouterGroup) GET

func (r *MyRouterGroup) GET(relativePath string, handlers ...HandlerFunc) gin.IRoutes

GET extend group GET

func (*MyRouterGroup) Group

func (group *MyRouterGroup) Group(relativePath string, handlers ...HandlerFunc) *MyRouterGroup

func (*MyRouterGroup) POST

func (r *MyRouterGroup) POST(relativePath string, handlers ...HandlerFunc) gin.IRoutes

POST extend group POST

func (*MyRouterGroup) Use

func (r *MyRouterGroup) Use(middlewares ...func(c *MyContext)) gin.IRoutes

Use extend register with middle

type MyServer

type MyServer struct {
	*gin.Engine
	CoreContext *context.CoreContext
}

func NewMyServer

func NewMyServer(ctx *context.CoreContext) *MyServer

NewMyServer new gin server

func (*MyServer) GET

func (server *MyServer) GET(relativePath string, handlers ...HandlerFunc) gin.IRoutes

GET extent GET

func (*MyServer) Group

func (server *MyServer) Group(relativePath string, handlers ...HandlerFunc) *MyRouterGroup

Group rewrite route register

func (*MyServer) POST

func (server *MyServer) POST(relativePath string, handlers ...HandlerFunc) gin.IRoutes

POST extend POST

type Result added in v1.1.0

type Result struct {
	Code    uint64      `json:"code"`
	Type    string      `json:"type"`
	Message string      `json:"message"`
	Result  interface{} `json:"result"`
}

func BadRequest added in v1.1.0

func BadRequest(message ...string) Result

func Success added in v1.1.0

func Success(result interface{}) Result

type UnitPriceParam added in v1.1.0

type UnitPriceParam struct {
	UnitPrice uint64 `json:"unitPrice"`
}

type VersionVo added in v1.3.2

type VersionVo struct {
	Version string `json:"version"`
}

Jump to

Keyboard shortcuts

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