notify

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventLogin = "login"
)
View Source
const (
	TopicSendMessage = "topic.notify.send_message"
)
View Source
const (
	TypeEmail = "email"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

func NewController

func NewController() *Controller

func (*Controller) RegisterRoute

func (c *Controller) RegisterRoute(group *gin.RouterGroup)

type EmailNotifier

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

func NewEmailNotifier

func NewEmailNotifier(conf config.Email) *EmailNotifier

func (*EmailNotifier) Send

func (n *EmailNotifier) Send(ctx context.Context, msg *MessageTemplate) error

type MessageReceiver

type MessageReceiver struct {
	Receivers []string `json:"-" gorm:"-"`
	Type      string   `json:"-" gorm:"-"`
}

type MessageTemplate

type MessageTemplate struct {
	ID             uuid.UUID `json:"id" gorm:"primary_key;type:uuid;"`
	Event          string    `json:"event" gorm:"not null;"`
	Subject        string    `json:"subject" gorm:"not null;"`
	Body           string    `json:"body" gorm:"not null;"`
	Level          string    `json:"level" gorm:"not null;"`
	DefaultSubject string    `json:"defaultSubject" gorm:"not null;"`
	DefaultBody    string    `json:"defaultBody" gorm:"not null;"`

	Receivers MessageReceiver `json:"-" gorm:"-"`

	database.BaseModel
}

func (*MessageTemplate) BeforeCreate

func (m *MessageTemplate) BeforeCreate(tx *gorm.DB) error

func (*MessageTemplate) TableName

func (m *MessageTemplate) TableName() string

type Notifier

type Notifier interface {
	Send(ctx context.Context, msg *MessageTemplate) error
}

type NotifierManager

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

func GetNotifierManager

func GetNotifierManager() *NotifierManager

func (*NotifierManager) AddNotifier

func (nm *NotifierManager) AddNotifier(name string, notifier Notifier)

func (*NotifierManager) GetNotifier

func (nm *NotifierManager) GetNotifier(name string) Notifier

type Service

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

func GetService

func GetService() *Service

func (*Service) Initialize

func (s *Service) Initialize() error

Jump to

Keyboard shortcuts

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