Documentation
¶
Index ¶
- Constants
- Variables
- func ConvertSizeBytes(size string) (uint64, error)
- func FileExists(path string) bool
- func ParseLineDetail(line string) (key, value string)
- func SplitOutput(regularExpression *regexp.Regexp, output []byte) [][]byte
- func UnmarshalToPointer[T any](responseData json.RawMessage, key string) (*T, error)
- func UnmarshalToSlice[T any](responseData json.RawMessage, key string) ([]T, error)
Constants ¶
View Source
const ( KB = 1 << 10 MB = 1 << 20 GB = 1 << 30 TB = 1 << 40 PB = 1 << 50 ErrInvalidSizeFormat = "invalid size format: %s" ErrInvalidSizeUnit = "invalid size unit: %s" )
Variables ¶
View Source
var ( ErrUnmarshal = errors.New("unmarshal failed") ErrKeyNotFound = errors.New("key not found") )
Functions ¶
func ConvertSizeBytes ¶
ConvertSizeBytes converts a size string to bytes.
func FileExists ¶
FileExists checks if a file exists at the given path.
func ParseLineDetail ¶
FIXME Might go in another file ParseLineDetail parses a line of the show detail command and returns the key and value.
func SplitOutput ¶
splitOutput splits the output into blocks based on the regular expression. TODO add tests.
func UnmarshalToPointer ¶
func UnmarshalToPointer[T any](responseData json.RawMessage, key string) (*T, error)
UnmashalToPointer unmarshals a JSON response data to a pointer.
func UnmarshalToSlice ¶
func UnmarshalToSlice[T any](responseData json.RawMessage, key string) ([]T, error)
UnmarshalToSlice unmarshals a JSON response data to a slice.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.