event

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package event is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEventChanCast            = errors.New("unable to cast event channel to []chan *Event")
	ErrNoSubscriberForEventType = errors.New("no subscriber for this event type")
)

Functions

func FxModule

func FxModule() fx.Option

func NewDispatcher

func NewDispatcher(
	cfg *configs.App,
	clock time.Clock,
) *dispatcher

Types

type CheckEvent

type CheckEvent struct {
	Principal      string
	ResourceKind   string
	ResourceValue  string
	Action         string
	IsAllowed      bool
	CompiledPolicy *model.CompiledPolicy
}

type Dispatcher

type Dispatcher interface {
	Dispatch(eventType EventType, data any) error
	Subscribe(eventType EventType) chan *Event
	Unsubscribe(eventType EventType, eventChanToClose chan *Event) error
}

type Event

type Event struct {
	Data      any
	Timestamp int64
}

type EventType

type EventType string
const (
	EventTypeCheck     EventType = "check"
	EventTypePolicy    EventType = "policy"
	EventTypePrincipal EventType = "principal"
	EventTypeResource  EventType = "resource"
	EventTypeRole      EventType = "role"
)

type ItemAction

type ItemAction string
const (
	ItemActionCreate ItemAction = "create"
	ItemActionUpdate ItemAction = "update"
)

type ItemEvent

type ItemEvent struct {
	Action ItemAction
	Data   any
}

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(eventType EventType, data any) error

Dispatch mocks base method.

func (*MockDispatcher) EXPECT

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

func (*MockDispatcher) Subscribe

func (m *MockDispatcher) Subscribe(eventType EventType) chan *Event

Subscribe mocks base method.

func (*MockDispatcher) Unsubscribe

func (m *MockDispatcher) Unsubscribe(eventType EventType, eventChanToClose chan *Event) error

Unsubscribe 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(eventType, data interface{}) *gomock.Call

Dispatch indicates an expected call of Dispatch.

func (*MockDispatcherMockRecorder) Subscribe

func (mr *MockDispatcherMockRecorder) Subscribe(eventType interface{}) *gomock.Call

Subscribe indicates an expected call of Subscribe.

func (*MockDispatcherMockRecorder) Unsubscribe

func (mr *MockDispatcherMockRecorder) Unsubscribe(eventType, eventChanToClose interface{}) *gomock.Call

Unsubscribe indicates an expected call of Unsubscribe.

Jump to

Keyboard shortcuts

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