timepass

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Advance

func Advance(t Handler, opts ...Option)

Advance 执行时间流逝检查 Advance performs time-pass check

Types

type EmptyTunnel

type EmptyTunnel struct{}

func (*EmptyTunnel) LastTouchedAt

func (e *EmptyTunnel) LastTouchedAt() time.Time

func (*EmptyTunnel) OnDay

func (e *EmptyTunnel) OnDay()

func (*EmptyTunnel) OnHour

func (e *EmptyTunnel) OnHour()

func (*EmptyTunnel) OnMinute

func (e *EmptyTunnel) OnMinute()

func (*EmptyTunnel) OnMonth

func (e *EmptyTunnel) OnMonth()

func (*EmptyTunnel) OnWeek

func (e *EmptyTunnel) OnWeek()

func (*EmptyTunnel) SetTouchedAt

func (e *EmptyTunnel) SetTouchedAt(t time.Time)

type Handler

type Handler interface {
	LastTouchedAt() time.Time
	SetTouchedAt(time.Time)
	OnMinute()
	OnHour()
	OnDay()
	OnWeek()
	OnMonth()
}

type Option

type Option func(t *handler)

func WithCurrentTime

func WithCurrentTime(currentTime time.Time) Option

WithCurrentTime 设置当前时间选项 WithCurrentTime sets the current time option

func WithWeekStartsAt

func WithWeekStartsAt(weekStartsAt string) Option

WithWeekStartsAt 设置周起始日选项 WithWeekStartsAt sets the week start day option

type Period

type Period string
const (
	Monthly  Period = "monthly"
	Weekly   Period = "weekly"
	Daily    Period = "daily"
	Hourly   Period = "hourly"
	Minutely Period = "minutely"
)

Jump to

Keyboard shortcuts

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