优化代码
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package shared
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
type TimeDurationUnit = string
|
||||
|
||||
@@ -34,3 +37,7 @@ func (this *TimeDuration) Duration() time.Duration {
|
||||
return time.Duration(this.Count) * time.Second
|
||||
}
|
||||
}
|
||||
|
||||
func (this *TimeDuration) AsJSON() ([]byte, error) {
|
||||
return json.Marshal(this)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user