timing

package module
v0.0.0-...-6e979e1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2016 License: MIT Imports: 5 Imported by: 0

README

timing

Remind you at your set time, like your alarm clock.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(items ...*Item)

Add 用来添加定时项并设置ID,必须先 Init,否则 Add 会一直等待 Init

func Init

func Init(items ...*Item)

Init 初始化定时器,并启动

Types

type HandlerFunc

type HandlerFunc func(items ...*Item)
var (
	// PersistFunc 落地定时项,以便系统重启后,恢复定时项
	PersistFunc HandlerFunc = func(items ...*Item) {}

	// DeleteFunc 时间到了,从落地库中移除定时项
	DeleteFunc HandlerFunc = func(items ...*Item) {}

	// RemindFunc 时间到了,提醒,处理定时项
	RemindFunc HandlerFunc = func(items ...*Item) {
		fmt.Printf("default remind: %#v\n", items)
	}
)

type Item

type Item struct {
	Id    string
	Timed uint32
	Event string
	Param string
}

type Queue

type Queue []*Item

func (Queue) Len

func (q Queue) Len() int

func (Queue) Less

func (q Queue) Less(i, j int) bool

func (*Queue) Pop

func (q *Queue) Pop() interface{}

func (*Queue) Push

func (q *Queue) Push(x interface{})

func (Queue) Swap

func (q Queue) Swap(i, j int)

Jump to

Keyboard shortcuts

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