You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
592 B
Go
30 lines
592 B
Go
package remind
|
|
|
|
import (
|
|
"b612.me/stardb"
|
|
"b612.me/startimer"
|
|
"sync"
|
|
)
|
|
|
|
type Remind struct {
|
|
db stardb.StarDB
|
|
tasks map[string]RemindTask
|
|
mu sync.Mutex
|
|
callBack func(remind RemindTask)
|
|
}
|
|
|
|
type RemindTask struct {
|
|
ID int `db:"id"`
|
|
Origin string `db:"text"`
|
|
timer startimer.StarTimer
|
|
Key string `db:"key"`
|
|
Msg []byte `db:"msg"`
|
|
}
|
|
|
|
func getCreateSql() []string {
|
|
return []string{
|
|
"CREATE TABLE IF NOT EXISTS remind(id INTEGER PRIMARY KEY AUTOINCREMENT,key VARCHAR(64),text TEXT,msg BLOB)",
|
|
"CREATE INDEX IF NOT EXISTS key_idx ON remind (key)",
|
|
}
|
|
}
|