matcher

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package matcher provides custom matchers for gRPC requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FnMatcher

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

FnMatcher is a matcher that call itself.

func Fn

func Fn(expected string, match MatchFn) FnMatcher

Fn creates a new FnMatcher matcher.

func (FnMatcher) Expected

func (f FnMatcher) Expected() string

Expected satisfies the matcher.Matcher interface.

func (FnMatcher) Match

func (f FnMatcher) Match(actual interface{}) (bool, error)

Match satisfies the matcher.Matcher interface.

type HeaderMatcher

type HeaderMatcher map[string]matcher.Matcher

HeaderMatcher matches the header values.

func (HeaderMatcher) Match

func (m HeaderMatcher) Match(ctx context.Context) error

Match matches the header in context.

type MatchFn

type MatchFn = func(v interface{}) (bool, error)

MatchFn is the match function to be used in FnMatcher.

type PayloadDecoder

type PayloadDecoder func(in interface{}) (string, error)

PayloadDecoder decodes an input for matching.

type PayloadMatcher

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

PayloadMatcher matches a payload of a grpc request.

func Payload

func Payload(m matcher.Matcher, decode PayloadDecoder) *PayloadMatcher

Payload initiates a new payload matcher.

func (PayloadMatcher) Actual

func (m PayloadMatcher) Actual() string

Actual returns the decoded input.

func (PayloadMatcher) Expected

func (m PayloadMatcher) Expected() string

Expected returns the expectation.

func (*PayloadMatcher) Match

func (m *PayloadMatcher) Match(in interface{}) (bool, error)

Match satisfies matcher.Matcher interface.

func (*PayloadMatcher) Matcher

func (m *PayloadMatcher) Matcher() matcher.Matcher

Matcher returns the underlay matcher.

Jump to

Keyboard shortcuts

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