command

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

Package command provides commands for rest/wasm/cli usage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteNillableResponse

func WriteNillableResponse(w io.Writer, v interface{}, l logger)

WriteNillableResponse is a utility function that writes v to w. If v is nil then an empty object is written. TODO this capability should be injected into the command implementations.

Types

type AriesHandler

type AriesHandler struct {
	Handler
}

AriesHandler implements aries handler.

func (AriesHandler) Handle

func (ah AriesHandler) Handle() command.Exec

Handle execute function of the command.

type Code

type Code int32

Code is the error code of command errors.

const (
	// UnknownStatus default error code for unknown errors.
	UnknownStatus Code = iota
)

type Error

type Error interface {
	error
	// Code returns error code for this command error.
	Code() Code
	// Code returns error type for this command error.
	Type() Type
}

Error is the interface for representing an command error condition, with the nil value representing no error.

func NewExecuteError

func NewExecuteError(code Code, err error) Error

NewExecuteError returns new command execute error.

func NewValidationError

func NewValidationError(code Code, err error) Error

NewValidationError returns new command validation error.

type Exec

type Exec func(rw io.Writer, req io.Reader) Error

Exec is controller command execution function type.

type Group

type Group int32

Group is the error groups. Note: recommended to use [0-9]*000 pattern for any new entries. Example: 2000, 3000, 4000 ...... 25000.

const (
	// DIDClient error group for DID client command errors.
	DIDClient Group = 1000

	// MediatorClient error group for mediator client command errors.
	MediatorClient Group = 2000

	// Store error group for Store command errors.
	Store Group = 3000
)

type Handler

type Handler interface {
	// name of the command
	Name() string
	// method name of the command
	Method() string
	// execute function of the command
	Handle() Exec
}

Handler for each controller command.

type Type

type Type int32

Type is command error type.

const (
	// ValidationError is error type for command validation errors.
	ValidationError Type = iota
	// ExecuteError is error type for command execution failure.
	ExecuteError Type = iota
)

Directories

Path Synopsis
Package blindedrouting provides blinded routing features for agents.
Package blindedrouting provides blinded routing features for agents.
Package didclient provides did commands.
Package didclient provides did commands.
Package mediatorclient provides client features for aries mediator commands.
Package mediatorclient provides client features for aries mediator commands.
Package store provides store commands.
Package store provides store commands.

Jump to

Keyboard shortcuts

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