Documentation
¶
Index ¶
- Constants
- func ConvertSize(sizeToConvert, unitToConvertTo string) (int, error)
- func ConvertTime(timeToConvert, unitToConvertTo string) (int, error)
- func ConvertToGB(size, unit string) (int, error)
- func ConvertToMB(size, unit string) (int, error)
- func GetPropertiesKVSet(i interface{}) map[string]interface{}
- func ParseDate(strDate string) (time.Time, error)
- func ReadPublicKey(path string) (key string, err error)
- func ValidateIPv6CidrBlockAgainstParentCidrBlock(cidr string, expectedMask int, parentCidr string) error
Constants ¶
View Source
const ( MegaBytes = "MB" GigaBytes = "GB" TerraBytes = "TB" PetaBytes = "PB" )
View Source
const ( Seconds = "s" Minutes = "m" Hours = "h" Days = "D" Months = "M" Years = "Y" )
Variables ¶
This section is empty.
Functions ¶
func ConvertSize ¶
ConvertSize converts the specified size to the unit specified Right now, it has support for MB, GB
func ConvertTime ¶ added in v6.8.0
func ConvertToGB ¶
func ConvertToMB ¶
func GetPropertiesKVSet ¶
func GetPropertiesKVSet(i interface{}) map[string]interface{}
GetPropertiesKVSet converts a struct to a map[string]interface{}. It will only include fields that are set and are not nil. It will also recursively convert any nested structs.
type MyStruct struct {
Field1 int
Field2 string
}
instance := MyStruct{Field1: 42, Field2: "Hello"}
result := GetPropertiesKVSet(instance) // map[string]interface{}{"Field1": 42, "Field2": "Hello"}
func ParseDate ¶ added in v6.8.0
ParseDate parses a date string in RFC3339 format and returns a time.Time object It also removes the [UTC] suffix if present
func ReadPublicKey ¶
ReadPublicKey from a specific path
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.