notification

package
v0.0.49 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Publish

func Publish(ctx context.Context, message Message) (int64, error)

Publish 调用当前进程注册的站内信发布方。

func SetDefaultPublisher

func SetDefaultPublisher(publisher Publisher)

SetDefaultPublisher 设置当前进程默认站内信发布方。

Types

type Audience

type Audience struct {
	// Type 是受众类型。
	Type basev1.MessageAudienceType
	// ID 是受众编号,租户全员时为 0。
	ID int64
	// IncludeChildren 表示部门受众是否包含子部门。
	IncludeChildren bool
}

Audience 描述站内信的单项受众规则。

type Message

type Message struct {
	// TenantID 是消息所属租户编号。
	TenantID int64
	// CategoryCode 是消息分类稳定编码。
	CategoryCode string
	// Title 是消息标题。
	Title string
	// Content 是消息正文。
	Content string
	// ContentFormat 是消息正文格式。
	ContentFormat basev1.MessageContentFormat
	// Priority 是消息优先级。
	Priority basev1.MessagePriority
	// ActionType 是消息动作类型。
	ActionType basev1.MessageActionType
	// ActionTarget 是消息动作目标。
	ActionTarget string
	// ActionParams 是消息动作参数 JSON。
	ActionParams string
	// Audiences 是消息受众规则。
	Audiences []Audience
	// Source 是业务来源标识。
	Source string
	// IdempotencyKey 是租户内来源幂等键。
	IdempotencyKey string
	// SenderName 是发送者显示名称。
	SenderName string
	// ExpiresAt 是消息过期时间戳,单位为毫秒。
	ExpiresAt int64
}

Message 描述业务模块发布站内信所需的消息内容。

type Publisher

type Publisher interface {
	Publish(context.Context, Message) (int64, error)
}

Publisher 定义业务模块发布站内信的能力。

type PublisherFunc

type PublisherFunc func(context.Context, Message) (int64, error)

PublisherFunc 将函数适配为 Publisher。

func (PublisherFunc) Publish

func (f PublisherFunc) Publish(ctx context.Context, message Message) (int64, error)

Publish 调用适配的发布函数。

Jump to

Keyboard shortcuts

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