grpc

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EqualToMessage

func EqualToMessage(message proto.Message) wiremock.BasicParamMatcher

EqualToMessage grpc alias for wiremock.MustEqualToJson. May panic if there are problems with marshaling.

Types

type ResponseBuilder

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

func Error

func Error(grpcResponseStatus codes.Code, grpcResponseReason string) *ResponseBuilder

Error creates a response builder with a gRPC error status and reason.

func Fault

func Fault(fault wiremock.Fault) *ResponseBuilder

func JSON

func JSON(json string) *ResponseBuilder

JSON creates a response builder with a JSON body.

func Message

func Message(message proto.Message) *ResponseBuilder

Message creates a response builder with a serialized proto message as the body. Can panic if there are problems with marshaling.

func (*ResponseBuilder) Build

func (b *ResponseBuilder) Build() wiremock.Response

func (*ResponseBuilder) WithDelay

func (b *ResponseBuilder) WithDelay(delay wiremock.DelayInterface) *ResponseBuilder

type Service

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

func NewService

func NewService(serviceName string, wiremock *wiremock.Client) *Service

NewService creates a new instance of the Service

func (*Service) StubFor

func (s *Service) StubFor(builder stubRuleBuilder) error

StubFor creates a new stub mapping for grpc service.

type StubRuleBuilder

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

func Method

func Method(method string) *StubRuleBuilder

Method creates a new instance of the StubRuleBuilder with grpc method.

func (*StubRuleBuilder) Build

func (s *StubRuleBuilder) Build(serviceName string) *wiremock.StubRule

Build builds a new instance of the StubRule.

func (*StubRuleBuilder) WillReturn

func (s *StubRuleBuilder) WillReturn(responseBuilder *ResponseBuilder) *StubRuleBuilder

WillReturn sets the response for the stub rule.

func (*StubRuleBuilder) WithRequestMessage

func (s *StubRuleBuilder) WithRequestMessage(matcher wiremock.BasicParamMatcher) *StubRuleBuilder

WithRequestMessage adds a request message matcher to the stub rule.

Jump to

Keyboard shortcuts

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