-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
72 lines (62 loc) · 1.15 KB
/
main.go
File metadata and controls
72 lines (62 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package main
import (
"fmt"
"github.com/annchain/commongo/format"
"github.com/annchain/commongo/pq"
"github.com/annchain/commongo/todolist"
"time"
)
func pqTest() {
q := &pq.PriorityQueue{}
q.Push(&pq.Item{
Value: 5,
Priority: 5,
})
q.Push(&pq.Item{
Value: 3,
Priority: 3,
})
q.Push(&pq.Item{
Value: 7,
Priority: 7,
})
fmt.Println(q.Len())
fmt.Println(q.Pop().(*pq.Item).Value)
fmt.Println(q.Pop().(*pq.Item).Value)
fmt.Println(q.Pop().(*pq.Item).Value)
fmt.Println(q.Pop().(*pq.Item).Value)
}
type Task struct {
value int
}
func (t Task) GetValue() interface{} {
return t.value
}
func (t Task) GetId() string {
return fmt.Sprintf("ID-%d", t.value)
}
func todolistTest() {
l := todolist.TodoList{
ExpireDuration: time.Second * 10,
MinimumIntervalDuration: time.Second * 5,
MaxTryTimes: 3,
}
l.InitDefault()
for i := 0; i < 10; i++ {
l.AddTask(Task{
value: i,
})
}
for {
v := l.GetTask()
fmt.Println("deque", v)
time.Sleep(time.Millisecond * 100)
}
}
func timeFormatTest() {
fmt.Println(format.FormatTimeToStandard(time.Now()))
}
func main() {
//todolistTest()
timeFormatTest()
}