Documentation
¶
Overview ¶
Package mock provides a mock client for testing
Index ¶
- func Response(service string, response []MockResponse) client.Option
- type MockClient
- func (m *MockClient) Call(ctx context.Context, req client.Request, rsp interface{}, ...) error
- func (m *MockClient) Init(opts ...client.Option) error
- func (m *MockClient) NewMessage(topic string, msg interface{}, opts ...client.MessageOption) client.Message
- func (m *MockClient) NewRequest(service, endpoint string, req interface{}, reqOpts ...client.RequestOption) client.Request
- func (m *MockClient) Options() client.Options
- func (m *MockClient) Publish(ctx context.Context, p client.Message, opts ...client.PublishOption) error
- func (m *MockClient) Stream(ctx context.Context, req client.Request, opts ...client.CallOption) (client.Stream, error)
- func (m *MockClient) String() string
- type MockResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MockClient ¶
type MockClient struct {
Client client.Client
Opts client.Options
sync.Mutex
Response map[string][]MockResponse
}
func NewClient ¶
func NewClient(opts ...client.Option) *MockClient
func (*MockClient) Call ¶
func (m *MockClient) Call(ctx context.Context, req client.Request, rsp interface{}, opts ...client.CallOption) error
func (*MockClient) NewMessage ¶ added in v0.8.0
func (m *MockClient) NewMessage(topic string, msg interface{}, opts ...client.MessageOption) client.Message
func (*MockClient) NewRequest ¶
func (m *MockClient) NewRequest(service, endpoint string, req interface{}, reqOpts ...client.RequestOption) client.Request
func (*MockClient) Options ¶
func (m *MockClient) Options() client.Options
func (*MockClient) Publish ¶
func (m *MockClient) Publish(ctx context.Context, p client.Message, opts ...client.PublishOption) error
func (*MockClient) Stream ¶
func (m *MockClient) Stream(ctx context.Context, req client.Request, opts ...client.CallOption) (client.Stream, error)
func (*MockClient) String ¶
func (m *MockClient) String() string
type MockResponse ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
client
module
|
|
|
mock
module
|
|
|
rpc
module
|
|
|
cmd
module
|
|
|
codec
module
|
|
|
bytes
module
|
|
|
grpc
module
|
|
|
json
module
|
|
|
jsonrpc
module
|
|
|
proto
module
|
|
|
protorpc
module
|
|
|
errors
module
|
|
|
metadata
module
|
|
|
registry
module
|
|
|
consul
module
|
|
|
gossip
module
|
|
|
gossip/proto
module
|
|
|
mdns
module
|
|
|
memory
module
|
|
|
selector
module
|
|
|
dns
module
|
|
|
registry
module
|
|
|
static
module
|
|
|
server
module
|
|
|
debug
module
|
|
|
mock
module
|
|
|
rpc
module
|
|
|
transport
module
|
|
|
http
module
|
|
|
memory
module
|
Click to show internal directories.
Click to hide internal directories.