validate

package
v0.15.6 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMiddleware

func NewMiddleware() eh.CommandHandlerMiddleware

NewMiddleware returns a new middleware that validate commands with its own validation method; `Validate() error`. Commands without the validate method will not be validated.

Types

type Command

type Command interface {
	eh.Command

	// Validate returns the error when validating the command.
	Validate() error
}

Command is a command with its own validation method.

func CommandWithValidation

func CommandWithValidation(cmd eh.Command, v func() error) Command

CommandWithValidation returns a wrapped command with a validation method.

type Error

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

Error is a validation error.

func (*Error) Cause

func (e *Error) Cause() error

Cause implements the github.com/pkg/errors Unwrap method.

func (*Error) Error

func (e *Error) Error() string

Error implements the Error method of the error interface.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap implements the errors.Unwrap method.

Jump to

Keyboard shortcuts

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