event

package
v5.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package event is a generated GoMock package.

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher interface {
	// Listen Register an event listener with the dispatcher.
	Listen(Event, Listener)

	// HasListeners Determine if a given event has listeners.
	HasListeners(Event) bool

	// Dispatch Fire an event and call the listeners.
	Dispatch(Event, any) error

	// Forget Shutdown a set of listeners from the dispatcher.
	Forget(Event)

	// GetListeners get all listeners by
	GetListeners(Event) []Listener

	// Run server.
	Run(context.Context) error

	// Shutdown server.
	Shutdown(context.Context) error

	List() map[Event][]Listener
}

func NewDispatcher

func NewDispatcher(logger mlog.Logger) Dispatcher

NewDispatcher return Dispatcher.

type Event

type Event string

func (Event) Is

func (e Event) Is(event Event) bool

func (Event) String

func (e Event) String() string

type Listener

type Listener func(any, Event) error

type MockDispatcher

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

MockDispatcher is a mock of Dispatcher interface.

func NewMockDispatcher

func NewMockDispatcher(ctrl *gomock.Controller) *MockDispatcher

NewMockDispatcher creates a new mock instance.

func (*MockDispatcher) Dispatch

func (m *MockDispatcher) Dispatch(arg0 Event, arg1 any) error

Dispatch mocks base method.

func (*MockDispatcher) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockDispatcher) Forget

func (m *MockDispatcher) Forget(arg0 Event)

Forget mocks base method.

func (*MockDispatcher) GetListeners

func (m *MockDispatcher) GetListeners(arg0 Event) []Listener

GetListeners mocks base method.

func (*MockDispatcher) HasListeners

func (m *MockDispatcher) HasListeners(arg0 Event) bool

HasListeners mocks base method.

func (*MockDispatcher) List

func (m *MockDispatcher) List() map[Event][]Listener

List mocks base method.

func (*MockDispatcher) Listen

func (m *MockDispatcher) Listen(arg0 Event, arg1 Listener)

Listen mocks base method.

func (*MockDispatcher) Run

func (m *MockDispatcher) Run(arg0 context.Context) error

Run mocks base method.

func (*MockDispatcher) Shutdown

func (m *MockDispatcher) Shutdown(arg0 context.Context) error

Shutdown mocks base method.

type MockDispatcherMockRecorder

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

MockDispatcherMockRecorder is the mock recorder for MockDispatcher.

func (*MockDispatcherMockRecorder) Dispatch

func (mr *MockDispatcherMockRecorder) Dispatch(arg0, arg1 any) *gomock.Call

Dispatch indicates an expected call of Dispatch.

func (*MockDispatcherMockRecorder) Forget

func (mr *MockDispatcherMockRecorder) Forget(arg0 any) *gomock.Call

Forget indicates an expected call of Forget.

func (*MockDispatcherMockRecorder) GetListeners

func (mr *MockDispatcherMockRecorder) GetListeners(arg0 any) *gomock.Call

GetListeners indicates an expected call of GetListeners.

func (*MockDispatcherMockRecorder) HasListeners

func (mr *MockDispatcherMockRecorder) HasListeners(arg0 any) *gomock.Call

HasListeners indicates an expected call of HasListeners.

func (*MockDispatcherMockRecorder) List

List indicates an expected call of List.

func (*MockDispatcherMockRecorder) Listen

func (mr *MockDispatcherMockRecorder) Listen(arg0, arg1 any) *gomock.Call

Listen indicates an expected call of Listen.

func (*MockDispatcherMockRecorder) Run

func (mr *MockDispatcherMockRecorder) Run(arg0 any) *gomock.Call

Run indicates an expected call of Run.

func (*MockDispatcherMockRecorder) Shutdown

func (mr *MockDispatcherMockRecorder) Shutdown(arg0 any) *gomock.Call

Shutdown indicates an expected call of Shutdown.

Jump to

Keyboard shortcuts

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