Merge pull request #9414 from ZhangShuaiyi/fix/tomlext_MarshalText
tomlext.Duration add MarshalText method
This commit is contained in:
commit
e2303c267e
@ -29,6 +29,10 @@ func (d *Duration) UnmarshalText(b []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d Duration) MarshalText() (text []byte, err error) {
|
||||||
|
return []byte(time.Duration(d).String()), nil
|
||||||
|
}
|
||||||
|
|
||||||
func ToStdTime(d Duration) time.Duration {
|
func ToStdTime(d Duration) time.Duration {
|
||||||
return time.Duration(d)
|
return time.Duration(d)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user