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

+6
View File
@@ -3,12 +3,18 @@ package function
import "time"
// Watcher is used for record code excution time
// Play: Todo
type Watcher struct {
startTime int64
stopTime int64
excuting bool
}
// Start the watch timer.
func NewWatcher() *Watcher {
return &Watcher{}
}
// Start the watch timer.
func (w *Watcher) Start() {
w.startTime = time.Now().UnixNano()