router

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

func NewContext(stub shim.ChaincodeStubInterface) *context

Types

type Chaincode

type Chaincode struct {
	// contains filtered or unexported fields
}

func NewChaincode

func NewChaincode(r *Group) *Chaincode

func (*Chaincode) Init

func (*Chaincode) Invoke

func (cc *Chaincode) Invoke(stub shim.ChaincodeStubInterface) pb.Response

type Context

type Context interface {
	Stub() shim.ChaincodeStubInterface
	Request() interface{}
	Path() string
	GetArgs() [][]byte
	SetHandler(*HandlerMeta)
	ReplaceArgs(args [][]byte) Context
	RequestArgs(interface{}) error
	FirstArgs() []byte
	GetStateByKey(string, string) ([]byte, error)
	PutStateByKey(string, string, []byte) error
	DelStateByKey(string, string) error
	PutStateByIndex(string, string, []byte, string, []string) error
	PutStateByCompositeKey(string, []string) error
	DelStateByCompositeKey(string, []string) error
	TimeUnixAndTx() (int64, string, error)

	// Json Response
	JSON(constant.ApiResult) (interface{}, error)
}

type ContextHandlerFunc

type ContextHandlerFunc func(Context) peer.Response

v0.1.0 OSP

type Group

type Group struct {
	// contains filtered or unexported fields
}

v0.1.0 OSP

func New

func New(name string) *Group

func (*Group) Context

func (g *Group) Context(stub shim.ChaincodeStubInterface) Context

func (*Group) Group

func (g *Group) Group(path string) *Group

func (*Group) Handle

func (g *Group) Handle(stub shim.ChaincodeStubInterface) peer.Response

func (*Group) HandleInit

func (g *Group) HandleInit(stub shim.ChaincodeStubInterface) peer.Response

func (*Group) Init

func (g *Group) Init(handler HandlerFunc) *Group

func (*Group) Invoke

func (g *Group) Invoke(path string, handler HandlerFunc, requestValidate interface{}) *Group

func (*Group) Query

func (g *Group) Query(path string, handler HandlerFunc, requestValidate interface{}) *Group

type HandlerFunc

type HandlerFunc func(Context) (interface{}, error)

v0.1.0 OSP

type HandlerMeta

type HandlerMeta struct {
	Hdl         HandlerFunc
	Type        MethodType
	ReqValidate interface{}
}

v0.1.0 OSP

type MethodType

type MethodType string

v0.1.0 OSP

type RequestMiddleware

type RequestMiddleware func(HandlerFunc, ...int) HandlerFunc

v0.1.0 OSP

type Router

type Router interface {
	HandleInit(stubInterface shim.ChaincodeStubInterface)
	Handle(stubInterface shim.ChaincodeStubInterface)
	Query(path string, handle HandlerFunc, middleware ...RequestMiddleware) Router
	Invoke(path string, handle HandlerFunc, middleware ...RequestMiddleware) Router
}

v0.1.0 OSP

Jump to

Keyboard shortcuts

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