commands

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 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 {

	// Handler method is the main method of an admin command. It is called only after a successful validation
	// by Validator method.
	// request parameter is the same object as passed to Validator method, so field ValidatorData can be used
	// to pass the validated parameters.
	// Any returned error will be returned to the caller with an error status code.
	// If no error is returned, the first return value is serialized and returned to a caller in an `Output` field.
	Handler(ctx context.Context, request *admin.CommandRequest) (interface{}, error)

	// Validator method is responsible for validating the input of a command, available in Data field of the request
	// argument.
	// Any error returned will abort the command execution and will be returned to the caller with InvalidArg error code
	// The same request object will be later passed to Handler method, so this method can set ValidatorData field with the
	// validated data needed to run the command
	Validator(request *admin.CommandRequest) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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