Documentation ¶
Overview ¶
Package pubsub is a generated GoMock package.
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
Copyright (c) Microsoft Corporation. Licensed under the MIT license.
Index ¶
- type CallBackFunc
- type MockPubSubInterface
- func (m *MockPubSubInterface) EXPECT() *MockPubSubInterfaceMockRecorder
- func (m *MockPubSubInterface) Publish(arg0 PubSubTopic, arg1 any)
- func (m *MockPubSubInterface) Subscribe(arg0 PubSubTopic, arg1 *CallBackFunc) string
- func (m *MockPubSubInterface) Unsubscribe(arg0 PubSubTopic, arg1 string) error
- type MockPubSubInterfaceMockRecorder
- type PubSub
- type PubSubInterface
- type PubSubTopic
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallBackFunc ¶
type CallBackFunc func(interface{})
type MockPubSubInterface ¶
type MockPubSubInterface struct {
// contains filtered or unexported fields
}
MockPubSubInterface is a mock of PubSubInterface interface.
func NewMockPubSubInterface ¶
func NewMockPubSubInterface(ctrl *gomock.Controller) *MockPubSubInterface
NewMockPubSubInterface creates a new mock instance.
func (*MockPubSubInterface) EXPECT ¶
func (m *MockPubSubInterface) EXPECT() *MockPubSubInterfaceMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockPubSubInterface) Publish ¶
func (m *MockPubSubInterface) Publish(arg0 PubSubTopic, arg1 any)
Publish mocks base method.
func (*MockPubSubInterface) Subscribe ¶
func (m *MockPubSubInterface) Subscribe(arg0 PubSubTopic, arg1 *CallBackFunc) string
Subscribe mocks base method.
func (*MockPubSubInterface) Unsubscribe ¶
func (m *MockPubSubInterface) Unsubscribe(arg0 PubSubTopic, arg1 string) error
Unsubscribe mocks base method.
type MockPubSubInterfaceMockRecorder ¶
type MockPubSubInterfaceMockRecorder struct {
// contains filtered or unexported fields
}
MockPubSubInterfaceMockRecorder is the mock recorder for MockPubSubInterface.
func (*MockPubSubInterfaceMockRecorder) Publish ¶
func (mr *MockPubSubInterfaceMockRecorder) Publish(arg0, arg1 any) *gomock.Call
Publish indicates an expected call of Publish.
func (*MockPubSubInterfaceMockRecorder) Subscribe ¶
func (mr *MockPubSubInterfaceMockRecorder) Subscribe(arg0, arg1 any) *gomock.Call
Subscribe indicates an expected call of Subscribe.
func (*MockPubSubInterfaceMockRecorder) Unsubscribe ¶
func (mr *MockPubSubInterfaceMockRecorder) Unsubscribe(arg0, arg1 any) *gomock.Call
Unsubscribe indicates an expected call of Unsubscribe.
type PubSub ¶
func (*PubSub) Publish ¶
func (p *PubSub) Publish(topic PubSubTopic, msg interface{})
Publish publishes the given message to the given topic, and calls all the callback functions subscribed to the topic.
func (*PubSub) Subscribe ¶
func (p *PubSub) Subscribe(topic PubSubTopic, callback *CallBackFunc) string
Subscribe subscribes to the given topic and calls the given callback function when a message is published to the topic, it returns a new uuid of the callback.
func (*PubSub) Unsubscribe ¶
func (p *PubSub) Unsubscribe(topic PubSubTopic, uuid string) error
Unsubscribe unsubscribes from the given topic.
type PubSubInterface ¶
type PubSubInterface interface { // Publish publishes the given message to the given topic Publish(topic PubSubTopic, msg interface{}) // Subscribe subscribes to the given topic and calls the given callback function // when a message is published to the topic Subscribe(topic PubSubTopic, callback *CallBackFunc) string // Unsubscribe unsubscribes from the given topic Unsubscribe(topic PubSubTopic, uuid string) error }
this file defines the interface a simple pubsub implementation should implement
type PubSubTopic ¶
type PubSubTopic string