notify

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicNotificationMessage

type BasicNotificationMessage[T any] interface {
	Message() (T, error)
}

BasicNotificationMessage 是一个泛型接口,Message 可以返回不同类型

type GeneratedMessage added in v0.1.5

type GeneratedMessage[T any] struct {
	Data T
}

GeneratedMessage 兼容动态数据

func (*GeneratedMessage[T]) Message added in v0.1.5

func (m *GeneratedMessage[T]) Message() (T, error)

type Notifier

type Notifier[T any] interface {
	Send(ctx context.Context, message BasicNotificationMessage[T]) (bool, error)
}

Notifier 是一个发送通知的接口,T 是 BasicNotificationMessage 的返回类型

type NotifierWrap added in v0.1.3

type NotifierWrap interface {
	Send(ctx context.Context) (bool, error)
}

func WrapNotifierDynamic added in v0.1.5

func WrapNotifierDynamic[T any](notifier Notifier[T], messageGen func() (
	BasicNotificationMessage[T], error)) NotifierWrap

func WrapNotifierStatic added in v0.1.5

func WrapNotifierStatic[T any](notifier Notifier[T], message BasicNotificationMessage[T]) NotifierWrap

WrapNotifierStatic 方法,支持静态和动态消息生成

type NotifierWrapper added in v0.1.3

type NotifierWrapper[T any] struct {
	Notifier   Notifier[T]
	Message    BasicNotificationMessage[T]
	MessageGen func() (BasicNotificationMessage[T], error)
}

func (NotifierWrapper[T]) Send added in v0.1.3

func (w NotifierWrapper[T]) Send(ctx context.Context) (bool, error)

type SystemNotify added in v0.1.3

type SystemNotify struct {
	Notify []NotifierWrap
}

func NewSystemNotify added in v0.1.3

func NewSystemNotify() *SystemNotify

func (*SystemNotify) AddNotify added in v0.1.3

func (n *SystemNotify) AddNotify(notifier NotifierWrap)

Directories

Path Synopsis
sms

Jump to

Keyboard shortcuts

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