Documentation
¶
Index ¶
- Variables
- func CopyFile(source, dest string) (err error)
- func ExtractNullInt(data any) (v null.Int)
- func ExtractNullString(data any) (v null.String)
- func ExtractNullTime(data any) (v null.Time)
- func ExtractStringArray(data any) (v []string)
- func FillString(currVal, newVal string) string
- func GetFQDNIPv4Address(fqdn string) (addr string)
- func GetIPAddressRDNS(addr string) (rdns string)
- func GetKey(needle string, haystack map[string]any) any
- func GzipData(input *[]byte) (output *[]byte, err error)
- func IsFlyioInstance() (isFly bool, region string)
- func IsMap(v any) bool
- func ListFolderFiles(folder string, includeDirectories bool) (files []os.FileInfo, err error)
- func NewLogger(l *log.Logger, prefix string) *log.Logger
- func ParseJSONFile(path string, data any) (err error)
- func RandomString(length int, upperCase, lowerCase, numbers bool) string
- func TruncateText(s string, maxLen int) string
- func UnGzipData(input *[]byte) (output *[]byte, err error)
- func WriteFile(path string, content *[]byte) (err error)
Constants ¶
This section is empty.
Variables ¶
var AWSRegionToRegion map[string]string = map[string]string{
"sa-east-1": "saopaulo",
"ca-central-1": "montreal",
"us-east-1": "virginia",
}
AWS region to application region map
var Empty any
Empty define an empty interface literal type to pass null as a parameter
var FlyioRegionToAPPRegion map[string]string = map[string]string{
"gru": "saopaulo",
"yul": "montreal",
"iad": "virginia",
}
Fly.io region into application region name
var RegionToAWSRegion map[string]string = map[string]string{
"saopaulo": "sa-east-1",
"montreal": "ca-central-1",
"virginia": "us-east-1",
}
application region to AWS region map
Functions ¶
func CopyFile ¶
CopyFile open and read the source file contents, then, call WriteFileto write the new file
func ExtractNullInt ¶ added in v0.5.0
ExtractNullInt extract a null.Int out of a interface that might not be int64
func ExtractNullString ¶ added in v0.5.0
ExtractNullString extract a null.String out of a interface that might not be string
func ExtractNullTime ¶ added in v0.9.1
ExtractNullTime extract a null.Time out of a string interface by parsing it in various formats
func ExtractStringArray ¶ added in v0.5.0
ExtractStringArray extract a array of strings out of an interface
func FillString ¶ added in v0.7.0
FillString check if the current string is empty, if so, return the new string
func GetFQDNIPv4Address ¶
GetFQDNIPv4Address fetch the first IPv4 address from an FQDN, ignoring errors
func GetIPAddressRDNS ¶
GetIPAddressRDNS fetch the reverse DNS address from an IP, ignoring errors
func GzipData ¶
GzipData take an content as a bytes pointer and Gzip those data, returning the output as bytes
func IsFlyioInstance ¶ added in v0.8.0
determine if the current running instance is a Fly.io instance
func ListFolderFiles ¶
ListFolderFiles take a folder path and walk through each item on it
func NewLogger ¶ added in v0.9.0
NewLogger create a new logger using the parent logger prefix and writer
func ParseJSONFile ¶
ParseJSONFile open the passed file from path and try to unmarshal its contents into the passed interface
func RandomString ¶
RandomString generate a random string of the passed length using the desired chars
func TruncateText ¶ added in v0.9.0
TruncateText truncate a text and add ellipsis to its end
func UnGzipData ¶
UnGzipData take a Gzip-ped content as a bytes pointer and undo the Gzip, returning the uncompressed data as bytes
Types ¶
This section is empty.