mirror of
https://gitee.com/johng/gf.git
synced 2024-11-30 19:27:46 +08:00
gcron updates
This commit is contained in:
parent
36199334f0
commit
cb24714faa
22
g/os/gcron/gcron_z_example_1_test.go
Normal file
22
g/os/gcron/gcron_z_example_1_test.go
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright 2019 gf Author(https://gitee.com/johng/gf). All Rights Reserved.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the MIT License.
|
||||
// If a copy of the MIT was not distributed with this file,
|
||||
// You can obtain one at https://gitee.com/johng/gf.
|
||||
|
||||
|
||||
package gcron_test
|
||||
|
||||
import (
|
||||
"gitee.com/johng/gf/g/os/gcron"
|
||||
"gitee.com/johng/gf/g/os/glog"
|
||||
"time"
|
||||
)
|
||||
|
||||
func ExampleCron_AddSingleton() {
|
||||
gcron.AddSingleton("* * * * * *", func() {
|
||||
glog.Println("doing")
|
||||
time.Sleep(2*time.Second)
|
||||
})
|
||||
select { }
|
||||
}
|
@ -1,12 +1,15 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gitee.com/johng/gf/g/util/grand"
|
||||
"gitee.com/johng/gf/g/os/gcron"
|
||||
"gitee.com/johng/gf/g/os/glog"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println(float64(10)/3)
|
||||
fmt.Println(grand.Meet(1, 1))
|
||||
fmt.Println(grand.MeetProb(float64(1)/2))
|
||||
gcron.AddSingleton("* * * * * *", func() {
|
||||
glog.Println("doing")
|
||||
time.Sleep(2*time.Second)
|
||||
})
|
||||
select { }
|
||||
}
|
Loading…
Reference in New Issue
Block a user