event

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogEventName              = "LogEvent"
	StartEventName            = "StartEvent"
	UserUpdateEventName       = "UserUpdateEvent"
	ThemeUpdateEventName      = "ThemeUpdateEvent"
	OptionUpdateEventName     = "OptionUpdateEvent"
	ThemeActivatedEventName   = "ThemeActivatedEvent"
	ThemeFileUpdatedEventName = "ThemeFileUpdatedEvent"
	PostUpdateEventName       = "PostUpdateEvent"
	CommentNewEventName       = "CommentNewEvent"
	CommentReplyEventName     = "CommentReplayEvent"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

type Bus interface {
	Publish(ctx context.Context, event Event)
	Subscribe(eventType string, listener Listener)
	UnSubscribe(eventType string, listener Listener)
}

func NewSyncEventBus

func NewSyncEventBus(logger *zap.Logger) Bus

type CommentNewEvent

type CommentNewEvent struct {
	Comment *entity.Comment
}

func (*CommentNewEvent) EventType

func (c *CommentNewEvent) EventType() string

type CommentReplyEvent

type CommentReplyEvent struct {
	Comment *entity.Comment
}

func (*CommentReplyEvent) EventType

func (c *CommentReplyEvent) EventType() string

type Event

type Event interface {
	EventType() string
}

type Listener

type Listener func(ctx context.Context, event Event) error

type LogEvent

type LogEvent struct {
	LogKey    string
	LogType   consts.LogType
	Content   string
	IPAddress string
}

func (*LogEvent) EventType

func (*LogEvent) EventType() string

type OptionUpdateEvent

type OptionUpdateEvent struct{}

func (*OptionUpdateEvent) EventType

func (o *OptionUpdateEvent) EventType() string

type PostUpdateEvent

type PostUpdateEvent struct {
	PostID int32
}

func (*PostUpdateEvent) EventType

func (p *PostUpdateEvent) EventType() string

type StartEvent

type StartEvent struct{}

func (*StartEvent) EventType

func (*StartEvent) EventType() string

type ThemeActivatedEvent

type ThemeActivatedEvent struct{}

func (*ThemeActivatedEvent) EventType

func (t *ThemeActivatedEvent) EventType() string

type ThemeFileUpdatedEvent

type ThemeFileUpdatedEvent struct{}

func (*ThemeFileUpdatedEvent) EventType

func (t *ThemeFileUpdatedEvent) EventType() string

type ThemeUpdateEvent

type ThemeUpdateEvent struct{}

func (*ThemeUpdateEvent) EventType

func (*ThemeUpdateEvent) EventType() string

type UserUpdateEvent

type UserUpdateEvent struct {
	UserID int32
}

func (*UserUpdateEvent) EventType

func (*UserUpdateEvent) EventType() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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