test&doc: add example and update doc for function package

This commit is contained in:
dudaodong committed 2023-01-06 17:12:32 +08:00
1 parent be444f521d
commit ca2a51b37e
8 files changed
+136 -70

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
package function
import "fmt"
func ExampleWatcher() {
w := NewWatcher()
w.Start()
longRunningTask()
w.Stop()
// eapsedTime := w.GetElapsedTime().Milliseconds()
fmt.Println("foo")
w.Reset()
// Output:
// foo
}