activity

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 10 Imported by: 0

README

Activity

Go doc

activity 活动状态管理

目录导航

列出了该 package 下所有的函数及类型定义,可通过目录导航进行快捷跳转 ❤️

展开 / 折叠目录导航

包级函数定义

函数名称 描述
SetTicker 设置自定义定时器,该方法必须在使用活动系统前调用,且只能调用一次
LoadGlobalData 加载所有活动全局数据
LoadEntityData 加载所有活动实体数据
LoadOrRefreshActivity 加载或刷新活动
DefineNoneDataActivity 声明无数据的活动类型
DefineGlobalDataActivity 声明拥有全局数据的活动类型
DefineEntityDataActivity 声明拥有实体数据的活动类型
DefineGlobalAndEntityDataActivity 声明拥有全局数据和实体数据的活动类型
RegUpcomingEvent 注册即将开始的活动事件处理器
OnUpcomingEvent 即将开始的活动事件
RegStartedEvent 注册活动开始事件处理器
OnStartedEvent 活动开始事件
RegEndedEvent 注册活动结束事件处理器
OnEndedEvent 活动结束事件
RegExtendedShowStartedEvent 注册活动结束后延长展示开始事件处理器
OnExtendedShowStartedEvent 活动结束后延长展示开始事件
RegExtendedShowEndedEvent 注册活动结束后延长展示结束事件处理器
OnExtendedShowEndedEvent 活动结束后延长展示结束事件
RegNewDayEvent 注册新的一天事件处理器
OnNewDayEvent 新的一天事件
NewOptions 创建活动选项

类型定义

类型 名称 描述
STRUCT Activity 活动描述
STRUCT Controller 活动控制器
INTERFACE BasicActivityController 暂无描述...
INTERFACE NoneDataActivityController 无数据活动控制器
INTERFACE GlobalDataActivityController 全局数据活动控制器
INTERFACE EntityDataActivityController 实体数据活动控制器
INTERFACE GlobalAndEntityDataActivityController 全局数据和实体数据活动控制器
STRUCT DataMeta 全局活动数据
STRUCT EntityDataMeta 活动实体数据
STRUCT UpcomingEventHandler 暂无描述...
STRUCT Options 活动选项

详情信息

func SetTicker(size int, options ...timer.Option)

设置自定义定时器,该方法必须在使用活动系统前调用,且只能调用一次


func LoadGlobalData(handler func (activityType any))

加载所有活动全局数据


func LoadEntityData(handler func (activityType any))

加载所有活动实体数据


func LoadOrRefreshActivity[Type generic.Basic, ID generic.Basic](activityType Type, activityId ID, options ...*Options) error

加载或刷新活动

  • 通常在活动配置刷新时候将活动通过该方法注册或刷新

func DefineNoneDataActivity[Type generic.Basic, ID generic.Basic](activityType Type) NoneDataActivityController[Type, ID, *none, none, *none]

声明无数据的活动类型


func DefineGlobalDataActivity[Type generic.Basic, ID generic.Basic, Data any](activityType Type) GlobalDataActivityController[Type, ID, Data, none, *none]

声明拥有全局数据的活动类型


func DefineEntityDataActivity[Type generic.Basic, ID generic.Basic, EntityID generic.Basic, EntityData any](activityType Type) EntityDataActivityController[Type, ID, *none, EntityID, EntityData]

声明拥有实体数据的活动类型


func DefineGlobalAndEntityDataActivity[Type generic.Basic, ID generic.Basic, Data any, EntityID generic.Basic, EntityData any](activityType Type) GlobalAndEntityDataActivityController[Type, ID, Data, EntityID, EntityData]

声明拥有全局数据和实体数据的活动类型


func RegUpcomingEvent[Type generic.Basic, ID generic.Basic](activityType Type, handler UpcomingEventHandler[ID], priority ...int)

注册即将开始的活动事件处理器


func OnUpcomingEvent[Type generic.Basic, ID generic.Basic](activity *Activity[Type, ID])

即将开始的活动事件


func RegStartedEvent[Type generic.Basic, ID generic.Basic](activityType Type, handler StartedEventHandler[ID], priority ...int)

注册活动开始事件处理器


func OnStartedEvent[Type generic.Basic, ID generic.Basic](activity *Activity[Type, ID])

活动开始事件


func RegEndedEvent[Type generic.Basic, ID generic.Basic](activityType Type, handler EndedEventHandler[ID], priority ...int)

注册活动结束事件处理器


func OnEndedEvent[Type generic.Basic, ID generic.Basic](activity *Activity[Type, ID])

活动结束事件


func RegExtendedShowStartedEvent[Type generic.Basic, ID generic.Basic](activityType Type, handler ExtendedShowStartedEventHandler[ID], priority ...int)

注册活动结束后延长展示开始事件处理器


func OnExtendedShowStartedEvent[Type generic.Basic, ID generic.Basic](activity *Activity[Type, ID])

活动结束后延长展示开始事件


func RegExtendedShowEndedEvent[Type generic.Basic, ID generic.Basic](activityType Type, handler ExtendedShowEndedEventHandler[ID], priority ...int)

注册活动结束后延长展示结束事件处理器


func OnExtendedShowEndedEvent[Type generic.Basic, ID generic.Basic](activity *Activity[Type, ID])

活动结束后延长展示结束事件


func RegNewDayEvent[Type generic.Basic, ID generic.Basic](activityType Type, handler NewDayEventHandler[ID], priority ...int)

注册新的一天事件处理器


func OnNewDayEvent[Type generic.Basic, ID generic.Basic](activity *Activity[Type, ID])

新的一天事件


func NewOptions() *Options

创建活动选项


Activity STRUCT

活动描述

type Activity[Type generic.Basic, ID generic.Basic] struct {
	id                ID
	t                 Type
	options           *Options
	state             byte
	lazy              bool
	tickerKey         string
	retention         time.Duration
	retentionKey      string
	mutex             sync.RWMutex
	getLastNewDayTime func() time.Time
	setLastNewDayTime func(time.Time)
	clearData         func()
	initializeData    func()
}

Controller STRUCT

活动控制器

type Controller[Type generic.Basic, ID generic.Basic, Data any, EntityID generic.Basic, EntityData any] struct {
	t          Type
	activities map[ID]*Activity[Type, ID]
	globalData map[ID]*DataMeta[Data]
	entityData map[ID]map[EntityID]*EntityDataMeta[EntityData]
	entityTof  reflect.Type
	globalInit func(activityId ID, data *DataMeta[Data])
	entityInit func(activityId ID, entityId EntityID, data *EntityDataMeta[EntityData])
	mutex      sync.RWMutex
}

func (*Controller) GetGlobalData(activityId ID) Data

获取特定活动全局数据


func (*Controller) GetEntityData(activityId ID, entityId EntityID) EntityData

获取特定活动实体数据


func (*Controller) IsOpen(activityId ID) bool

活动是否开启


func (*Controller) IsShow(activityId ID) bool

活动是否展示


func (*Controller) IsOpenOrShow(activityId ID) bool

活动是否开启或展示


func (*Controller) Refresh(activityId ID)

刷新活动


func (*Controller) InitializeNoneData(handler func (activityId ID, data *DataMeta[Data])) NoneDataActivityController[Type, ID, Data, EntityID, EntityData]

func (*Controller) InitializeGlobalData(handler func (activityId ID, data *DataMeta[Data])) GlobalDataActivityController[Type, ID, Data, EntityID, EntityData]

func (*Controller) InitializeEntityData(handler func (activityId ID, entityId EntityID, data *EntityDataMeta[EntityData])) EntityDataActivityController[Type, ID, Data, EntityID, EntityData]

func (*Controller) InitializeGlobalAndEntityData(handler func (activityId ID, data *DataMeta[Data]), entityHandler func (activityId ID, entityId EntityID, data *EntityDataMeta[EntityData])) GlobalAndEntityDataActivityController[Type, ID, Data, EntityID, EntityData]

BasicActivityController INTERFACE
type BasicActivityController[Type generic.Basic, ID generic.Basic, Data any, EntityID generic.Basic, EntityData any] interface {
	IsOpen(activityId ID) bool
	IsShow(activityId ID) bool
	IsOpenOrShow(activityId ID) bool
	Refresh(activityId ID)
}

NoneDataActivityController INTERFACE

无数据活动控制器

type NoneDataActivityController[Type generic.Basic, ID generic.Basic, Data any, EntityID generic.Basic, EntityData any] interface {
	BasicActivityController[Type, ID, Data, EntityID, EntityData]
	InitializeNoneData(handler func(activityId ID, data *DataMeta[Data])) NoneDataActivityController[Type, ID, Data, EntityID, EntityData]
}

GlobalDataActivityController INTERFACE

全局数据活动控制器

type GlobalDataActivityController[Type generic.Basic, ID generic.Basic, Data any, EntityID generic.Basic, EntityData any] interface {
	BasicActivityController[Type, ID, Data, EntityID, EntityData]
	GetGlobalData(activityId ID) Data
	InitializeGlobalData(handler func(activityId ID, data *DataMeta[Data])) GlobalDataActivityController[Type, ID, Data, EntityID, EntityData]
}

EntityDataActivityController INTERFACE

实体数据活动控制器

type EntityDataActivityController[Type generic.Basic, ID generic.Basic, Data any, EntityID generic.Basic, EntityData any] interface {
	BasicActivityController[Type, ID, Data, EntityID, EntityData]
	GetEntityData(activityId ID, entityId EntityID) EntityData
	InitializeEntityData(handler func(activityId ID, entityId EntityID, data *EntityDataMeta[EntityData])) EntityDataActivityController[Type, ID, Data, EntityID, EntityData]
}

GlobalAndEntityDataActivityController INTERFACE

全局数据和实体数据活动控制器

type GlobalAndEntityDataActivityController[Type generic.Basic, ID generic.Basic, Data any, EntityID generic.Basic, EntityData any] interface {
	BasicActivityController[Type, ID, Data, EntityID, EntityData]
	GetGlobalData(activityId ID) Data
	GetEntityData(activityId ID, entityId EntityID) EntityData
	InitializeGlobalAndEntityData(handler func(activityId ID, data *DataMeta[Data]), entityHandler func(activityId ID, entityId EntityID, data *EntityDataMeta[EntityData])) GlobalAndEntityDataActivityController[Type, ID, Data, EntityID, EntityData]
}

DataMeta STRUCT

全局活动数据

type DataMeta[Data any] struct {
	once       sync.Once
	Data       Data
	LastNewDay time.Time
}

EntityDataMeta STRUCT

活动实体数据

type EntityDataMeta[Data any] struct {
	once       sync.Once
	Data       Data
	LastNewDay time.Time
}

UpcomingEventHandler STRUCT
type UpcomingEventHandler[ID generic.Basic] func(activityId ID)

Options STRUCT

活动选项

type Options struct {
	Tl   *times.StateLine[byte]
	Loop time.Duration
}

func (*Options) WithUpcomingTime(t time.Time) *Options

设置活动预告时间


func (*Options) WithStartTime(t time.Time) *Options

设置活动开始时间


func (*Options) WithEndTime(t time.Time) *Options

设置活动结束时间


func (*Options) WithExtendedShowTime(t time.Time) *Options

设置延长展示时间


func (*Options) WithLoop(interval time.Duration) *Options

设置活动循环,时间间隔小于等于 0 表示不循环

  • 当活动状态展示结束后,会根据该选项设置的时间间隔重新开始

Documentation

Overview

Package activity 活动状态管理

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadEntityData added in v0.3.2

func LoadEntityData(handler func(activityType, activityId, entityId, data any))

LoadEntityData 加载所有活动实体数据

func LoadGlobalData added in v0.3.2

func LoadGlobalData(handler func(activityType, activityId, data any))

LoadGlobalData 加载所有活动全局数据

func LoadOrRefreshActivity added in v0.3.2

func LoadOrRefreshActivity[Type, ID generic.Basic](activityType Type, activityId ID, options ...*Options) error

LoadOrRefreshActivity 加载或刷新活动

  • 通常在活动配置刷新时候将活动通过该方法注册或刷新

func OnEndedEvent added in v0.3.2

func OnEndedEvent[Type, ID generic.Basic](activity *Activity[Type, ID])

OnEndedEvent 活动结束事件

func OnExtendedShowEndedEvent added in v0.3.2

func OnExtendedShowEndedEvent[Type, ID generic.Basic](activity *Activity[Type, ID])

OnExtendedShowEndedEvent 活动结束后延长展示结束事件

func OnExtendedShowStartedEvent added in v0.3.2

func OnExtendedShowStartedEvent[Type, ID generic.Basic](activity *Activity[Type, ID])

OnExtendedShowStartedEvent 活动结束后延长展示开始事件

func OnNewDayEvent added in v0.3.2

func OnNewDayEvent[Type, ID generic.Basic](activity *Activity[Type, ID])

OnNewDayEvent 新的一天事件

func OnStartedEvent added in v0.3.2

func OnStartedEvent[Type, ID generic.Basic](activity *Activity[Type, ID])

OnStartedEvent 活动开始事件

func OnUpcomingEvent added in v0.3.2

func OnUpcomingEvent[Type, ID generic.Basic](activity *Activity[Type, ID])

OnUpcomingEvent 即将开始的活动事件

func RegEndedEvent added in v0.3.2

func RegEndedEvent[Type, ID generic.Basic](activityType Type, handler EndedEventHandler[ID], priority ...int)

RegEndedEvent 注册活动结束事件处理器

func RegExtendedShowEndedEvent added in v0.3.2

func RegExtendedShowEndedEvent[Type, ID generic.Basic](activityType Type, handler ExtendedShowEndedEventHandler[ID], priority ...int)

RegExtendedShowEndedEvent 注册活动结束后延长展示结束事件处理器

func RegExtendedShowStartedEvent added in v0.3.2

func RegExtendedShowStartedEvent[Type, ID generic.Basic](activityType Type, handler ExtendedShowStartedEventHandler[ID], priority ...int)

RegExtendedShowStartedEvent 注册活动结束后延长展示开始事件处理器

func RegNewDayEvent added in v0.3.2

func RegNewDayEvent[Type, ID generic.Basic](activityType Type, handler NewDayEventHandler[ID], priority ...int)

RegNewDayEvent 注册新的一天事件处理器

func RegStartedEvent added in v0.3.2

func RegStartedEvent[Type, ID generic.Basic](activityType Type, handler StartedEventHandler[ID], priority ...int)

RegStartedEvent 注册活动开始事件处理器

func RegUpcomingEvent added in v0.3.2

func RegUpcomingEvent[Type, ID generic.Basic](activityType Type, handler UpcomingEventHandler[ID], priority ...int)

RegUpcomingEvent 注册即将开始的活动事件处理器

func SetTicker added in v0.0.3

func SetTicker(size int, options ...timer.Option)

SetTicker 设置自定义定时器,该方法必须在使用活动系统前调用,且只能调用一次

Types

type Activity

type Activity[Type, ID generic.Basic] struct {
	// contains filtered or unexported fields
}

Activity 活动描述

type BasicActivityController added in v0.3.2

type BasicActivityController[Type, ID generic.Basic, Data any, EntityID generic.Basic, EntityData any] interface {
	// IsOpen 活动是否开启
	IsOpen(activityId ID) bool
	// IsShow 活动是否展示
	IsShow(activityId ID) bool
	// IsOpenOrShow 活动是否开启或展示
	IsOpenOrShow(activityId ID) bool
	// Refresh 刷新活动
	Refresh(activityId ID)
}

type Controller added in v0.3.2

type Controller[Type, ID generic.Basic, Data any, EntityID generic.Basic, EntityData any] struct {
	// contains filtered or unexported fields
}

Controller 活动控制器

func (*Controller[Type, ID, Data, EntityID, EntityData]) GetEntityData added in v0.3.2

func (slf *Controller[Type, ID, Data, EntityID, EntityData]) GetEntityData(activityId ID, entityId EntityID) EntityData

GetEntityData 获取特定活动实体数据

func (*Controller[Type, ID, Data, EntityID, EntityData]) GetGlobalData added in v0.3.2

func (slf *Controller[Type, ID, Data, EntityID, EntityData]) GetGlobalData(activityId ID) Data

GetGlobalData 获取特定活动全局数据

func (*Controller[Type, ID, Data, EntityID, EntityData]) InitializeEntityData added in v0.3.3

func (slf *Controller[Type, ID, Data, EntityID, EntityData]) InitializeEntityData(handler func(activityId ID, entityId EntityID, data *EntityDataMeta[EntityData])) EntityDataActivityController[Type, ID, Data, EntityID, EntityData]

func (*Controller[Type, ID, Data, EntityID, EntityData]) InitializeGlobalAndEntityData added in v0.3.3

func (slf *Controller[Type, ID, Data, EntityID, EntityData]) InitializeGlobalAndEntityData(handler func(activityId ID, data *DataMeta[Data]), entityHandler func(activityId ID, entityId EntityID, data *EntityDataMeta[EntityData])) GlobalAndEntityDataActivityController[Type, ID, Data, EntityID, EntityData]

func (*Controller[Type, ID, Data, EntityID, EntityData]) InitializeGlobalData added in v0.3.3

func (slf *Controller[Type, ID, Data, EntityID, EntityData]) InitializeGlobalData(handler func(activityId ID, data *DataMeta[Data])) GlobalDataActivityController[Type, ID, Data, EntityID, EntityData]

func (*Controller[Type, ID, Data, EntityID, EntityData]) InitializeNoneData added in v0.3.3

func (slf *Controller[Type, ID, Data, EntityID, EntityData]) InitializeNoneData(handler func(activityId ID, data *DataMeta[Data])) NoneDataActivityController[Type, ID, Data, EntityID, EntityData]

func (*Controller[Type, ID, Data, EntityID, EntityData]) IsOpen added in v0.3.2

func (slf *Controller[Type, ID, Data, EntityID, EntityData]) IsOpen(activityId ID) bool

IsOpen 活动是否开启

func (*Controller[Type, ID, Data, EntityID, EntityData]) IsOpenOrShow added in v0.3.2

func (slf *Controller[Type, ID, Data, EntityID, EntityData]) IsOpenOrShow(activityId ID) bool

IsOpenOrShow 活动是否开启或展示

func (*Controller[Type, ID, Data, EntityID, EntityData]) IsShow added in v0.3.2

func (slf *Controller[Type, ID, Data, EntityID, EntityData]) IsShow(activityId ID) bool

IsShow 活动是否展示

func (*Controller[Type, ID, Data, EntityID, EntityData]) Refresh added in v0.3.2

func (slf *Controller[Type, ID, Data, EntityID, EntityData]) Refresh(activityId ID)

Refresh 刷新活动

type DataMeta added in v0.3.2

type DataMeta[Data any] struct {
	Data       Data      `json:"data,omitempty"`         // 活动数据
	LastNewDay time.Time `json:"last_new_day,omitempty"` // 上次跨天时间
	// contains filtered or unexported fields
}

DataMeta 全局活动数据

type EndedEventHandler added in v0.3.2

type EndedEventHandler[ID generic.Basic] func(activityId ID) // 活动结束事件处理器

type EntityDataActivityController added in v0.3.2

type EntityDataActivityController[Type, ID generic.Basic, Data any, EntityID generic.Basic, EntityData any] interface {
	BasicActivityController[Type, ID, Data, EntityID, EntityData]
	// GetEntityData 获取实体数据
	GetEntityData(activityId ID, entityId EntityID) EntityData
	// InitializeEntityData 初始化活动
	//  - 该函数提供了一个操作活动数据的入口,可以在该函数中对传入的活动数据进行初始化
	InitializeEntityData(handler func(activityId ID, entityId EntityID, data *EntityDataMeta[EntityData])) EntityDataActivityController[Type, ID, Data, EntityID, EntityData]
}

EntityDataActivityController 实体数据活动控制器

func DefineEntityDataActivity added in v0.3.2

func DefineEntityDataActivity[Type, ID, EntityID generic.Basic, EntityData any](activityType Type) EntityDataActivityController[Type, ID, *none, EntityID, EntityData]

DefineEntityDataActivity 声明拥有实体数据的活动类型

type EntityDataMeta added in v0.3.2

type EntityDataMeta[Data any] struct {
	Data       Data      `json:"data,omitempty"`         // 活动数据
	LastNewDay time.Time `json:"last_new_day,omitempty"` // 上次跨天时间
	// contains filtered or unexported fields
}

EntityDataMeta 活动实体数据

type ExtendedShowEndedEventHandler added in v0.3.2

type ExtendedShowEndedEventHandler[ID generic.Basic] func(activityId ID) // 活动结束后延长展示结束事件处理器

type ExtendedShowStartedEventHandler added in v0.3.2

type ExtendedShowStartedEventHandler[ID generic.Basic] func(activityId ID) // 活动结束后延长展示开始事件处理器

type GlobalAndEntityDataActivityController added in v0.3.2

type GlobalAndEntityDataActivityController[Type, ID generic.Basic, Data any, EntityID generic.Basic, EntityData any] interface {
	BasicActivityController[Type, ID, Data, EntityID, EntityData]
	// GetGlobalData 获取全局数据
	GetGlobalData(activityId ID) Data
	// GetEntityData 获取实体数据
	GetEntityData(activityId ID, entityId EntityID) EntityData
	// InitializeGlobalAndEntityData 初始化活动
	//  - 该函数提供了一个操作活动数据的入口,可以在该函数中对传入的活动数据进行初始化
	InitializeGlobalAndEntityData(handler func(activityId ID, data *DataMeta[Data]), entityHandler func(activityId ID, entityId EntityID, data *EntityDataMeta[EntityData])) GlobalAndEntityDataActivityController[Type, ID, Data, EntityID, EntityData]
}

GlobalAndEntityDataActivityController 全局数据和实体数据活动控制器

func DefineGlobalAndEntityDataActivity added in v0.3.2

func DefineGlobalAndEntityDataActivity[Type, ID generic.Basic, Data any, EntityID generic.Basic, EntityData any](activityType Type) GlobalAndEntityDataActivityController[Type, ID, Data, EntityID, EntityData]

DefineGlobalAndEntityDataActivity 声明拥有全局数据和实体数据的活动类型

type GlobalDataActivityController added in v0.3.2

type GlobalDataActivityController[Type, ID generic.Basic, Data any, EntityID generic.Basic, EntityData any] interface {
	BasicActivityController[Type, ID, Data, EntityID, EntityData]
	// GetGlobalData 获取全局数据
	GetGlobalData(activityId ID) Data
	// InitializeGlobalData 初始化活动
	//  - 该函数提供了一个操作活动数据的入口,可以在该函数中对传入的活动数据进行初始化
	InitializeGlobalData(handler func(activityId ID, data *DataMeta[Data])) GlobalDataActivityController[Type, ID, Data, EntityID, EntityData]
}

GlobalDataActivityController 全局数据活动控制器

func DefineGlobalDataActivity added in v0.3.2

func DefineGlobalDataActivity[Type, ID generic.Basic, Data any](activityType Type) GlobalDataActivityController[Type, ID, Data, none, *none]

DefineGlobalDataActivity 声明拥有全局数据的活动类型

type NewDayEventHandler added in v0.3.2

type NewDayEventHandler[ID generic.Basic] func(activityId ID) // 新的一天事件处理器

type NoneDataActivityController added in v0.3.2

type NoneDataActivityController[Type, ID generic.Basic, Data any, EntityID generic.Basic, EntityData any] interface {
	BasicActivityController[Type, ID, Data, EntityID, EntityData]
	// InitializeNoneData 初始化活动
	//  - 该函数提供了一个操作活动数据的入口,可以在该函数中对传入的活动数据进行初始化
	//
	// 对于无数据活动,该函数的意义在于,可以在该函数中对活动进行初始化,比如设置活动的状态等,虽然为无数据活动,但是例如活动本身携带的状态数据也是需要加载的
	InitializeNoneData(handler func(activityId ID, data *DataMeta[Data])) NoneDataActivityController[Type, ID, Data, EntityID, EntityData]
}

NoneDataActivityController 无数据活动控制器

func DefineNoneDataActivity added in v0.3.2

func DefineNoneDataActivity[Type, ID generic.Basic](activityType Type) NoneDataActivityController[Type, ID, *none, none, *none]

DefineNoneDataActivity 声明无数据的活动类型

type Options added in v0.3.3

type Options struct {
	Tl   *times.StateLine[byte] // 活动时间线
	Loop time.Duration          // 活动循环,时间间隔小于等于 0 表示不循环
}

Options 活动选项

func NewOptions added in v0.3.3

func NewOptions() *Options

NewOptions 创建活动选项

func (*Options) WithEndTime added in v0.3.3

func (slf *Options) WithEndTime(t time.Time) *Options

WithEndTime 设置活动结束时间

func (*Options) WithExtendedShowTime added in v0.3.3

func (slf *Options) WithExtendedShowTime(t time.Time) *Options

WithExtendedShowTime 设置延长展示时间

func (*Options) WithLoop added in v0.3.3

func (slf *Options) WithLoop(interval time.Duration) *Options

WithLoop 设置活动循环,时间间隔小于等于 0 表示不循环

  • 当活动状态展示结束后,会根据该选项设置的时间间隔重新开始

func (*Options) WithStartTime added in v0.3.3

func (slf *Options) WithStartTime(t time.Time) *Options

WithStartTime 设置活动开始时间

func (*Options) WithUpcomingTime added in v0.3.3

func (slf *Options) WithUpcomingTime(t time.Time) *Options

WithUpcomingTime 设置活动预告时间

type StartedEventHandler added in v0.3.2

type StartedEventHandler[ID generic.Basic] func(activityId ID) // 活动开始事件处理器

type UpcomingEventHandler added in v0.3.2

type UpcomingEventHandler[ID generic.Basic] func(activityId ID) // 即将开始的活动事件处理器

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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