修正logsize的解析问题

This commit is contained in:
lwch
2021-08-13 10:20:45 +08:00
parent 947963798d
commit 0bf8d57e06
7 changed files with 38 additions and 10 deletions
+23
View File
@@ -0,0 +1,23 @@
package utils
import "github.com/dustin/go-humanize"
type Bytes uint64
func (bt *Bytes) UnmarshalYAML(unmarshal func(interface{}) error) error {
var str string
err := unmarshal(&str)
if err != nil {
return err
}
n, err := humanize.ParseBytes(str)
if err != nil {
return err
}
*bt = Bytes(n)
return nil
}
func (bt *Bytes) Bytes() uint64 {
return uint64(*bt)
}