Parse parses human readable bytes string to bytes integer. For example, 6GiB (6Gi is also valid) will return 6442450944, and 6GB (6G is also valid) will return 6000000000.
(value string)
| 122 | // For example, 6GiB (6Gi is also valid) will return 6442450944, and |
| 123 | // 6GB (6G is also valid) will return 6000000000. |
| 124 | func (b *Bytes) Parse(value string) (int64, error) { |
| 125 | |
| 126 | i, err := b.ParseBinary(value) |
| 127 | if err == nil { |
| 128 | return i, err |
| 129 | } |
| 130 | |
| 131 | return b.ParseDecimal(value) |
| 132 | } |
| 133 | |
| 134 | // ParseBinary parses human readable bytes string to bytes integer. |
| 135 | // For example, 6GiB (6Gi is also valid) will return 6442450944. |
no test coverage detected