event

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dispatch

func Dispatch(evt interface{})

Dispatch an event to Dispatcher

func SetDispatcher

func SetDispatcher(disp Dispatcher)

SetDispatcher set a event dispatcher

Types

type Dispatcher

type Dispatcher interface {
	Publish(evt interface{})
}

Dispatcher is an interface for event dispatcher

type EventManager

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

EventManager is a manager for event dispatch

func NewEventManager

func NewEventManager(store EventStore) *EventManager

NewEventManager create a eventManager

func (*EventManager) Call

func (em *EventManager) Call(evt interface{}, listener Listener)

Call trigger listener to execute

func (*EventManager) Listen

func (em *EventManager) Listen(listeners ...Listener)

Listen create a relation from event to listners

func (*EventManager) Publish

func (em *EventManager) Publish(evt interface{})

Publish a event

type EventStore

type EventStore interface {
	Listen(eventName string, listener Listener)
	Publish(eventName string, evt interface{})
	SetManager(*EventManager)
}

EventStore is a interface for event store

type Listener

type Listener interface{}

Listener is a event listener

type MemoryEventStore

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

MemoryEventStore is a event store for sync operations

func NewMemoryEventStore

func NewMemoryEventStore() *MemoryEventStore

NewMemoryEventStore create a sync event store

func (*MemoryEventStore) Listen

func (eventStore *MemoryEventStore) Listen(evtType string, listener Listener)

Listen add a listener to a event

func (*MemoryEventStore) Publish

func (eventStore *MemoryEventStore) Publish(evtType string, evt interface{})

Publish publish a event

func (*MemoryEventStore) SetManager

func (eventStore *MemoryEventStore) SetManager(manager *EventManager)

SetManager event manager

type MigrationEndedEvent

type MigrationEndedEvent struct {
	SQL string
}

type MigrationStartedEvent

type MigrationStartedEvent struct {
	SQL string
}

type MigrationsEndedEvent

type MigrationsEndedEvent struct{}

type MigrationsStartedEvent

type MigrationsStartedEvent struct{}

type QueryExecutedEvent

type QueryExecutedEvent struct {
	SQL      string
	Bindings []interface{}
	Time     time.Duration
}

QueryExecutedEvent each SQL query executed by your application will publish a QueryExecutedEvent

type TransactionBeginningEvent

type TransactionBeginningEvent struct{}

TransactionBeginningEvent fired when a new transaction started

type TransactionCommittedEvent

type TransactionCommittedEvent struct{}

TransactionCommittedEvent fired when a transaction has been committed

type TransactionRolledBackEvent

type TransactionRolledBackEvent struct{}

TransactionRolledBackEvent fired when a transaction has been rollback

Jump to

Keyboard shortcuts

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