tomlext.Duration add MarshalText method
Signed-off-by: Shuaiyi Zhang <zhang_syi@qq.com>
This commit is contained in:
parent
6ed8f01aa1
commit
ad3f8c563b
@ -29,6 +29,10 @@ func (d *Duration) UnmarshalText(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d Duration) MarshalText() (text []byte, err error) {
|
||||
return []byte(time.Duration(d).String()), nil
|
||||
}
|
||||
|
||||
func ToStdTime(d Duration) time.Duration {
|
||||
return time.Duration(d)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user