mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-17 16:12:42 +08:00
update
This commit is contained in:
@ -9,3 +9,16 @@ func ParseDuration(s string) (time.Duration, error) {
|
||||
|
||||
return time.ParseDuration(s)
|
||||
}
|
||||
|
||||
func ParseDurationDefault(s string, d time.Duration) time.Duration {
|
||||
if len(s) == 0 {
|
||||
return d
|
||||
}
|
||||
|
||||
ret, err := time.ParseDuration(s)
|
||||
if err != nil {
|
||||
return d
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
14
calendar/scheduled_executor.go
Normal file
14
calendar/scheduled_executor.go
Normal file
@ -0,0 +1,14 @@
|
||||
package calendar
|
||||
|
||||
import "time"
|
||||
|
||||
type ScheduledExecutor struct {
|
||||
}
|
||||
|
||||
func NewScheduledExecutor() *ScheduledExecutor {
|
||||
return &ScheduledExecutor{}
|
||||
}
|
||||
|
||||
func (e *ScheduledExecutor) Schedule(i any, duration time.Duration) {
|
||||
|
||||
}
|
14
calendar/scheduled_executor_test.go
Normal file
14
calendar/scheduled_executor_test.go
Normal file
@ -0,0 +1,14 @@
|
||||
package calendar_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/charlienet/go-mixed/calendar"
|
||||
)
|
||||
|
||||
func TestExecutor(t *testing.T) {
|
||||
executor := calendar.NewScheduledExecutor()
|
||||
|
||||
executor.Schedule(nil, time.Minute)
|
||||
}
|
Reference in New Issue
Block a user