commands

package
v0.35.10-crescendo-pre... Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: AGPL-3.0 Imports: 3 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToInterfaceList added in v0.24.5

func ConvertToInterfaceList(list interface{}) ([]interface{}, error)

func ConvertToMap added in v0.24.5

func ConvertToMap(object interface{}) (map[string]interface{}, error)

Types

type AdminCommand

type AdminCommand interface {
	// Validator is responsible for validating the input of a command, available in
	// the Data field of the request argument. By convention, Validator may set the
	// ValidatorData field on the request, and this will persist when the request
	// is passed to Handler.
	//
	// Returns admin.InvalidAdminReqError if request validation fails.
	// Any error returned will abort the command execution.
	// Expected errors will be returned to the caller with InvalidArg error code.
	// Unexpected errors will be returned with Internal error code, but will not be otherwise propagated.
	Validator(request *admin.CommandRequest) error

	// Handler is responsible for handling the request. It applies any state
	// changes associated with the request and returns any values which should
	// be displayed to the initiator of the request.
	//
	// No errors are expected during normal operation.
	// If any error is returned, the command was aborted.
	// Unexpected errors will be returned with Internal error code, but will not be otherwise propagated.
	Handler(ctx context.Context, request *admin.CommandRequest) (any, error)
}

AdminCommand defines the interface expected for admin command handlers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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