fs: Implement Scan method for SizeSuffix and Duration

This commit is contained in:
Nick Craig-Wood
2018-05-14 16:32:27 +01:00
parent 028f8a69d3
commit 1c80e84f8a
4 changed files with 75 additions and 4 deletions

View File

@@ -110,3 +110,12 @@ func (x *SizeSuffix) Set(s string) error {
func (x *SizeSuffix) Type() string {
return "int64"
}
// Scan implements the fmt.Scanner interface
func (x *SizeSuffix) Scan(s fmt.ScanState, ch rune) error {
token, err := s.Token(true, nil)
if err != nil {
return err
}
return x.Set(string(token))
}