Documentation
¶
Index ¶
- Constants
- func Between(value string, a string, b string) string
- func BigEndianUInt16(value uint16) (value1 byte, value2 byte)
- func BigEndianUInt32(value uint32) (value1 byte, value2 byte, value3 byte, value4 byte)
- func BoolToString(val bool) string
- func CopyFile(source string, dest string) (err error)
- func CopyFolder(source string, dest string) (err error)
- func DWordToInt(data []byte) (num int32)
- func DirSize(path string) (int64, error)
- func DirSizeWithSearch(path string, fileSearch string) (int64, error)
- func DoesFileExist(path string) bool
- func DoesFileNotExist(path string) bool
- func ExtractArgsWithinBrackets(str string) (res []string)
- func FloatToString(input_num float64, precision int) string
- func GenPackageImport(name string, imports []string) string
- func GetAllDirWithExclude(path string, except string) (files []os.FileInfo, err error)
- func GetAllDirs(path string) (files []os.FileInfo, err error)
- func GetAllFiles(path string) (files []os.FileInfo, err error)
- func GetAllFilesDeepWithSearch(path string, fileSearch string) (files []os.FileInfo, err error)
- func GetAllFilesSortedBy(path string, fileSearch string) (files []os.FileInfo, err error)
- func GetAllFilesWithSearch(path string, fileSearch string) (files []os.FileInfo, err error)
- func GetAllFolders(path string) (files []os.FileInfo, err error)
- func GetAllFoldersWithSearch(path string, fileSearch string) (files []os.FileInfo, err error)
- func GetDecimalAndStringFromHex(twoDigitHexCode string) (decimalValue int, asciiString string, err error)
- func GetFileSize(path string) (size int64, err error)
- func GetUserAgentName(req *http.Request) (name string)
- func Gzipfunc(source string, target string) (err error)
- func HexToInt(hexStr string) int
- func Int32ToDWORD(val int32) (value []byte)
- func Int32ToInt(val int32) (ret int)
- func Int32ToString(val int32) string
- func Int64ToInt32(val int64) (ret int)
- func Int64ToString(val int64) string
- func IntToBool(val int) bool
- func IntToString(val int) string
- func IpAddressToUint32(ip string) (value uint32)
- func IsPrintable(s string) bool
- func LeftPad(s string, padStr string, pLen int) string
- func LeftPad2Len(s string, padStr string, overallLen int) string
- func MD5(path string) (string, error)
- func MakeFirstLowerCase(s string) string
- func MkDir(path string) error
- func MkDirRWAll(path string) error
- func NewUUID() (string, error)
- func ParseAndWriteFile(path string, v interface{}, perm os.FileMode) (err error)
- func PrintKiloBytes(bytes int64) string
- func PrintMegaBytes(bytes int64) string
- func PrintZettaBytes(bytes int64) string
- func Random(min, max int) int
- func RandomString(strlen int) string
- func ReadFile(path string) ([]byte, error)
- func ReadFileAndParse(path string, v interface{}) (err error)
- func RemoveDirectory(dir string) error
- func RemoveDirectoryShell(dir string) (err error)
- func RightPad(s string, padStr string, pLen int) string
- func RightPad2Len(s string, padStr string, overallLen int) string
- func Round(x, unit float64) float64
- func StringToBool(val string) bool
- func StringToFloat(val string, precision int) (r float64)
- func StringToInt(val string) int
- func StringToUInt16(val string) uint16
- func StringToUInt64(val string) uint64
- func StringToUInt8(val string) uint8
- func SyncMapAny(x *sync.Map) (ok bool)
- func SyncMapLength(x *sync.Map) (length int)
- func Tar(source string, target string) error
- func TrimSuffix(s, suffix string) string
- func UnGzipfunc(source, target string) error
- func UnTar(tarball, target string) error
- func Write(value string, path string) error
- func WriteAndGoFmt(value string, path string, quiet bool, perm os.FileMode) error
- func WriteAndGoFormat(value string, path string) error
- func WriteToFile(value string, path string, perm os.FileMode) error
- type ByOldestFile
- type FilePath
- type Version
Constants ¶
const ( UNIX_READ = 04 UNIX_WRITE = 02 UNIX_EX = 01 UNIX_USER_SHIFT = 6 UNIX_GROUP_SHIFT = 3 UNIX_OTH_SHIFT = 0 UNIX_USER_R = UNIX_READ << UNIX_USER_SHIFT UNIX_USER_W = UNIX_WRITE << UNIX_USER_SHIFT UNIX_USER_X = UNIX_EX << UNIX_USER_SHIFT UNIX_USER_RW = UNIX_USER_R | UNIX_USER_W UNIX_USER_RWX = UNIX_USER_RW | UNIX_USER_X UNIX_GROUP_R = UNIX_READ << UNIX_GROUP_SHIFT UNIX_GROUP_W = UNIX_WRITE << UNIX_GROUP_SHIFT UNIX_GROUP_X = UNIX_EX << UNIX_GROUP_SHIFT UNIX_GROUP_RW = UNIX_GROUP_R | UNIX_GROUP_W UNIX_GROUP_RWX = UNIX_GROUP_RW | UNIX_GROUP_X UNIX_OTH_R = UNIX_READ << UNIX_OTH_SHIFT UNIX_OTH_W = UNIX_WRITE << UNIX_OTH_SHIFT UNIX_OTH_X = UNIX_EX << UNIX_OTH_SHIFT UNIX_OTH_RW = UNIX_OTH_R | UNIX_OTH_W UNIX_OTH_RWX = UNIX_OTH_RW | UNIX_OTH_X UNIX_ALL_R = UNIX_USER_R | UNIX_GROUP_R | UNIX_OTH_R UNIX_ALL_W = UNIX_USER_W | UNIX_GROUP_W | UNIX_OTH_W UNIX_ALL_X = UNIX_USER_X | UNIX_GROUP_X | UNIX_OTH_X UNIX_ALL_RW = UNIX_ALL_R | UNIX_ALL_W UNIX_ALL_RWX = UNIX_ALL_RW | UNIX_GROUP_X UNIX_COMMON_FILE = (UNIX_USER_RW | UNIX_ALL_R) UNIX_COMMON_DIR = os.ModeDir | (UNIX_USER_RWX | UNIX_ALL_R) UNIX_DIR_RWALL = os.ModeDir | (UNIX_USER_RWX | UNIX_ALL_RW) )
These constants are to be used when you are passing an os.FileMode uint32 because it's easier to compose exactly what you want and gives you common directory that needs execute.
Variables ¶
This section is empty.
Functions ¶
func BigEndianUInt16 ¶
BigEndianUInt16 will convert a uint16 to 2 bytes
func BigEndianUInt32 ¶
BigEndianUInt32 will convert a uint32 to 4 bytes
func BoolToString ¶
func CopyFolder ¶
func DoesFileExist ¶
func DoesFileNotExist ¶
func FloatToString ¶
func GenPackageImport ¶
func GetAllDirWithExclude ¶
func GetAllFilesSortedBy ¶
func GetAllFilesWithSearch ¶
func GetAllFoldersWithSearch ¶
func GetFileSize ¶
func GetUserAgentName ¶
GetUserAgentName will return the name of the user agent.
func Int32ToDWORD ¶
Int32ToDWORD converts an int32 to DWORD byte array.
func Int32ToInt ¶
func Int32ToString ¶
func Int64ToInt32 ¶
func Int64ToString ¶
func IntToString ¶
func IpAddressToUint32 ¶
IpAddressToUint32 will convert a string ip address to UInt32
func IsPrintable ¶
func MakeFirstLowerCase ¶
func MkDirRWAll ¶ added in v1.4.9
func ParseAndWriteFile ¶
func PrintKiloBytes ¶
func PrintMegaBytes ¶
func PrintZettaBytes ¶
func RandomString ¶
RandomString returns a random string of length
func ReadFileAndParse ¶
func RemoveDirectory ¶
func RemoveDirectoryShell ¶
func RightPad2Len ¶
the Pad2Len functions are generally assumed to be padded with short sequences of strings
* in many cases with a single character sequence * * so we assume we can build the string out as if the char seq is 1 char and then * just substr the string if it is longer than needed * * this means we are wasting some cpu and memory work * but this always get us to want we want it to be * * in short not optimized to for massive string work * * If the overallLen is shorter than the original string length * the string will be shortened to this length (substr) *
func StringToBool ¶
func StringToFloat ¶
func StringToInt ¶
func StringToUInt16 ¶
func StringToUInt64 ¶
func StringToUInt8 ¶
func SyncMapAny ¶
SyncMapAny will return true if there are any items in the sync.Map
func SyncMapLength ¶
SyncMapLength will return true the length of items in the sync.Map
func Tar ¶
Tar takes a source and variable writers and walks 'source' writing each file found to the tar writer; the purpose for accepting multiple writers is to allow for multiple outputs (for example a file, or md5 hash)
func TrimSuffix ¶
func UnGzipfunc ¶
func WriteAndGoFmt ¶
func WriteAndGoFormat ¶
Types ¶
type ByOldestFile ¶
func (ByOldestFile) Len ¶
func (a ByOldestFile) Len() int
func (ByOldestFile) Less ¶
func (a ByOldestFile) Less(i, j int) bool
func (ByOldestFile) Swap ¶
func (a ByOldestFile) Swap(i, j int)