validator

package module
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultClientErrorFunc = func(req client.Request, rsp interface{}, err error) error {
		if rsp != nil {
			return errors.BadGateway(req.Service(), "%v", err)
		}
		return errors.BadRequest(req.Service(), "%v", err)
	}

	DefaultServerErrorFunc = func(req server.Request, rsp interface{}, err error) error {
		if rsp != nil {
			return errors.BadGateway(req.Service(), "%v", err)
		}
		return errors.BadRequest(req.Service(), "%v", err)
	}

	DefaultPublishErrorFunc = func(msg client.Message, err error) error {
		return errors.BadRequest(msg.Topic(), "%v", err)
	}

	DefaultSubscribeErrorFunc = func(msg server.Message, err error) error {
		return errors.BadRequest(msg.Topic(), "%v", err)
	}
)

Functions

func NewHook added in v3.2.0

func NewHook(opts ...Option) *hook

Types

type ClientErrorFunc

type ClientErrorFunc func(client.Request, interface{}, error) error

type Option

type Option func(*Options)

Option func signature

func ClientReqErrorFn added in v3.1.3

func ClientReqErrorFn(fn ClientErrorFunc) Option

func ClientValidateResponse added in v3.2.0

func ClientValidateResponse(b bool) Option

func PublishErrorFn

func PublishErrorFn(fn PublishErrorFunc) Option

func ServerErrorFn

func ServerErrorFn(fn ServerErrorFunc) Option

func ServerValidateResponse added in v3.2.0

func ServerValidateResponse(b bool) Option

func SubscribeErrorFn

func SubscribeErrorFn(fn SubscribeErrorFunc) Option

type Options

type Options struct {
	ClientErrorFn          ClientErrorFunc
	ServerErrorFn          ServerErrorFunc
	PublishErrorFn         PublishErrorFunc
	SubscribeErrorFn       SubscribeErrorFunc
	ClientValidateResponse bool
	ServerValidateResponse bool
}

Options struct holds wrapper options

func NewOptions

func NewOptions(opts ...Option) Options

type PublishErrorFunc

type PublishErrorFunc func(client.Message, error) error

type ServerErrorFunc

type ServerErrorFunc func(server.Request, interface{}, error) error

type SubscribeErrorFunc

type SubscribeErrorFunc func(server.Message, error) error

Jump to

Keyboard shortcuts

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