Documentation
¶
Index ¶
- Variables
- type Router
- func (r *Router) ArgCount(method string) int
- func (r *Router) AuthRequired(method string) bool
- func (r *Router) Check(stub shim.ChaincodeStubInterface, method string, args ...string) error
- func (r *Router) Function(method string) string
- func (r *Router) Handlers() map[string]string
- func (r *Router) Invoke(stub shim.ChaincodeStubInterface, method string, args ...string) ([]byte, error)
- func (r *Router) IsInvoke(method string) bool
- func (r *Router) IsQuery(method string) bool
- func (r *Router) IsTransaction(method string) bool
- func (r *Router) Method(function string) string
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrChaincodeFunction is returned when a chaincode function has already been defined in the router. ErrChaincodeFunction = errors.New("chaincode function already defined") // ErrUnsupportedMethod is returned when a method is not supported by the router. ErrUnsupportedMethod = errors.New("unsupported method") )
Functions ¶
This section is empty.
Types ¶
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router is a multiplexer that routes methods to the appropriate handler.
func NewRouter ¶
NewRouter creates a new Router with the provided routing.Router instances. It returns an error if any chaincode function is defined more than once.
func (*Router) ArgCount ¶
ArgCount returns the number of arguments the method takes (excluding the receiver).
func (*Router) AuthRequired ¶
AuthRequired indicates if the method requires authentication.
func (*Router) Function ¶
Function returns the name of the chaincode function by the specified method.
func (*Router) Invoke ¶
func (r *Router) Invoke(stub shim.ChaincodeStubInterface, method string, args ...string) ([]byte, error)
Invoke calls the specified method with the provided arguments.
func (*Router) IsTransaction ¶
IsTransaction checks if the method is a transaction type.
Click to show internal directories.
Click to hide internal directories.