mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-06-16 09:52:17 +08:00
go1.16 (#14783)
This commit is contained in:
12
vendor/github.com/prometheus/common/model/time.go
generated
vendored
12
vendor/github.com/prometheus/common/model/time.go
generated
vendored
@ -254,6 +254,18 @@ func (d Duration) String() string {
|
||||
return r
|
||||
}
|
||||
|
||||
// MarshalText implements the encoding.TextMarshaler interface.
|
||||
func (d *Duration) MarshalText() ([]byte, error) {
|
||||
return []byte(d.String()), nil
|
||||
}
|
||||
|
||||
// UnmarshalText implements the encoding.TextUnmarshaler interface.
|
||||
func (d *Duration) UnmarshalText(text []byte) error {
|
||||
var err error
|
||||
*d, err = ParseDuration(string(text))
|
||||
return err
|
||||
}
|
||||
|
||||
// MarshalYAML implements the yaml.Marshaler interface.
|
||||
func (d Duration) MarshalYAML() (interface{}, error) {
|
||||
return d.String(), nil
|
||||
|
Reference in New Issue
Block a user