Documentation ¶
Index ¶
- func Validate(ctx context.Context, req *transport.Request) (*transport.Request, error)
- func ValidateOneway(ctx context.Context, req *transport.Request) (*transport.Request, error)
- func ValidateUnary(ctx context.Context, req *transport.Request) (*transport.Request, error)
- type OnewayValidatorOutbound
- type UnaryValidatorOutbound
- type Validator
- func (v *Validator) ParseTTL(ctx context.Context, ttl string) (context.Context, func())
- func (v *Validator) Validate(ctx context.Context) (*transport.Request, error)
- func (v *Validator) ValidateOneway(ctx context.Context) (*transport.Request, error)
- func (v *Validator) ValidateUnary(ctx context.Context) (*transport.Request, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Validate ¶
Validate is a shortcut for the case where a request needs to be validated without changing the TTL. This should be used to validate all request types
func ValidateOneway ¶ added in v0.4.0
ValidateOneway validates a oneway request. This should be used after a successful Validate()
Types ¶
type OnewayValidatorOutbound ¶ added in v0.4.0
type OnewayValidatorOutbound struct{ transport.OnewayOutbound }
OnewayValidatorOutbound wraps an Outbound to validate all outgoing oneway requests.
func (OnewayValidatorOutbound) CallOneway ¶ added in v0.4.0
func (o OnewayValidatorOutbound) CallOneway(ctx context.Context, request *transport.Request) (transport.Ack, error)
CallOneway performs the given request, failing early if the request is invalid.
type UnaryValidatorOutbound ¶ added in v0.4.0
type UnaryValidatorOutbound struct{ transport.UnaryOutbound }
UnaryValidatorOutbound wraps an Outbound to validate all outgoing unary requests.
type Validator ¶
Validator helps validate requests.
v := Validator{Request: request} v.Validate() ... v.ParseTTL(ttlstring) request, err := v.ValidateUnary()
func (*Validator) ParseTTL ¶
ParseTTL takes a context parses the given TTL, clamping the context to that TTL and as a side-effect, tracking any errors encountered while attempting to parse and validate that TTL. Should only be used for unary requests
func (*Validator) Validate ¶
Validate checks that the request inside this validator is valid and returns either the validated request or an error. This should be used to check all requests, prior to the RPC type specifc validation.
func (*Validator) ValidateOneway ¶ added in v0.4.0
ValidateOneway validates a oneway request. This should be used after a successful Validate()