2021-02-16 10:47:02 +00:00
|
|
|
package types
|
2020-12-13 08:58:58 +00:00
|
|
|
|
2021-02-13 21:50:14 +00:00
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
)
|
2020-12-13 08:58:58 +00:00
|
|
|
|
2020-12-13 19:59:32 +00:00
|
|
|
type DiskType string
|
2020-12-13 08:58:58 +00:00
|
|
|
|
|
|
|
const (
|
2021-02-16 18:50:42 +00:00
|
|
|
HardDriveType DiskType = ""
|
2020-12-16 17:14:05 +00:00
|
|
|
SsdType = "ssd"
|
2020-12-13 08:58:58 +00:00
|
|
|
)
|
|
|
|
|
2021-02-13 21:50:14 +00:00
|
|
|
func ToDiskType(vt string) (diskType DiskType) {
|
|
|
|
vt = strings.ToLower(vt)
|
2020-12-13 19:59:32 +00:00
|
|
|
diskType = HardDriveType
|
2020-12-13 08:58:58 +00:00
|
|
|
switch vt {
|
|
|
|
case "", "hdd":
|
2020-12-13 19:59:32 +00:00
|
|
|
diskType = HardDriveType
|
2020-12-13 08:58:58 +00:00
|
|
|
case "ssd":
|
2020-12-13 19:59:32 +00:00
|
|
|
diskType = SsdType
|
2020-12-13 08:58:58 +00:00
|
|
|
default:
|
2021-02-13 21:50:14 +00:00
|
|
|
diskType = DiskType(vt)
|
2020-12-13 08:58:58 +00:00
|
|
|
}
|
|
|
|
return
|
|
|
|
}
|
2021-02-13 23:42:42 +00:00
|
|
|
|
2021-02-18 04:57:08 +00:00
|
|
|
func (diskType DiskType) String() string {
|
2021-02-13 23:42:42 +00:00
|
|
|
if diskType == "" {
|
2021-02-16 18:50:42 +00:00
|
|
|
return ""
|
2021-02-13 23:42:42 +00:00
|
|
|
}
|
|
|
|
return string(diskType)
|
|
|
|
}
|
2021-02-22 09:59:03 +00:00
|
|
|
|
|
|
|
func (diskType DiskType) ReadableString() string {
|
|
|
|
if diskType == "" {
|
|
|
|
return "hdd"
|
|
|
|
}
|
|
|
|
return string(diskType)
|
|
|
|
}
|