utils

package
v6.7.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MegaBytes  = "MB"
	GigaBytes  = "GB"
	TerraBytes = "TB"
	PetaBytes  = "PB"
)

Variables

This section is empty.

Functions

func ConvertSize

func ConvertSize(sizeToConvert, unitToConvertTo string) (int, error)

ConvertSize converts the specified size to the unit specified Right now, it has support for MB, GB

func ConvertToGB

func ConvertToGB(size, unit string) (int, error)

func ConvertToMB

func ConvertToMB(size, unit string) (int, error)

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 ReadPublicKey

func ReadPublicKey(path string) (key string, err error)

ReadPublicKey from a specific path

func ValidateIPv6CidrBlockAgainstParentCidrBlock

func ValidateIPv6CidrBlockAgainstParentCidrBlock(cidr string, expectedMask int, parentCidr string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL