Documentation
¶
Overview ¶
pxnGoCommon - Core @copyright 2026 PoiXson @license AGPL+PXN @author lorenzo at poixson.com @link https://PoiXson.com/
pxnGoCommon - Core @copyright 2026 PoiXson @license AGPL+PXN @author lorenzo at poixson.com @link https://PoiXson.com/
pxnGoCommon - Core @copyright 2026 PoiXson @license AGPL+PXN @author lorenzo at poixson.com @link https://PoiXson.com/
pxnGoCommon - Core @copyright 2026 PoiXson @license AGPL+PXN @author lorenzo at poixson.com @link https://PoiXson.com/
pxnGoCommon - Core @copyright 2026 PoiXson @license AGPL+PXN @author lorenzo at poixson.com @link https://PoiXson.com/
pxnGoCommon - Core @copyright 2026 PoiXson @license AGPL+PXN @author lorenzo at poixson.com @link https://PoiXson.com/
pxnGoCommon - Core @copyright 2026 PoiXson @license AGPL+PXN @author lorenzo at poixson.com @link https://PoiXson.com/
pxnGoCommon - Core @copyright 2026 PoiXson @license AGPL+PXN @author lorenzo at poixson.com @link https://PoiXson.com/
pxnGoCommon - Core @copyright 2026 PoiXson @license AGPL+PXN @author lorenzo at poixson.com @link https://PoiXson.com/
pxnGoCommon - Core @copyright 2026 PoiXson @license AGPL+PXN @author lorenzo at poixson.com @link https://PoiXson.com/
pxnGoCommon - Core @copyright 2026 PoiXson @license AGPL+PXN @author lorenzo at poixson.com @link https://PoiXson.com/
pxnGoCommon - Core @copyright 2026 PoiXson @license AGPL+PXN @author lorenzo at poixson.com @link https://PoiXson.com/
pxnGoCommon - Core @copyright 2026 PoiXson @license AGPL+PXN @author lorenzo at poixson.com @link https://PoiXson.com/
pxnGoCommon - Core @copyright 2026 PoiXson @license AGPL+PXN @author lorenzo at poixson.com @link https://PoiXson.com/
Index ¶
- Constants
- Variables
- func AnyToString(val any) string
- func Clamp[...](val T, min T, max T) T
- func ColorHexPercent(color string, percent float64) string
- func CreateDir(path string) (bool, error)
- func CreateUser(name string, id int, home bool, system bool) error
- func ExpandPath(path string) string
- func FileModeToStr0xxx(mode FileMode) string
- func FindPathFileExt(paths []string, names []string, exts []string) string
- func FormatByteSize(size int64) (float64, string)
- func FormatByteSizeString(size int64) string
- func FromBase36(str string) (uint64, error)
- func GetArch() string
- func GetCWD() string
- func GetExecPath() string
- func GetGroupID(name string) int
- func GetHostName() string
- func GetNevra(name string, version string, epoch uint16, release uint16, os string, ...) string
- func GetOS() string
- func GetRunPath() string
- func GetUserID(name string) int
- func GroupExists(name string) bool
- func InPath(name string) bool
- func IsDir(path string) bool
- func IsExisting(path string) bool
- func IsFile(file string) bool
- func IsRootUser() (bool, error)
- func IsSafeAlpha(str string) bool
- func IsSafeAlphaLower(str string) bool
- func IsSafeAlphaNum(str string) bool
- func IsSafeAlphaUpper(str string) bool
- func IsSafeDomain(str string) bool
- func IsSafeDomainPort(str string) bool
- func IsSafeFilePath(str string) bool
- func IsSanSafe(str string, pattern string) bool
- func LoadConfig[T any](file string) (*T, error)
- func LoadConfigR[T any](file string) (*T, map[string]any, error)
- func Max[...](vals ...T) T
- func Min[...](vals ...T) T
- func ParseBool(value string) (bool, bool)
- func ParseBoolDef(value string, defval bool) bool
- func ParseByteSize(size string) (int64, error)
- func ParseHexColor(color string) (int, int, int, error)
- func ParseNevra(file string) (string, string)
- func ParseOwnerID(own string) (int, int, error)
- func RemoveIndex[T any](array []T, index int) []T
- func RunCommand(timeout *Time.Duration, cmd string, args []string) error
- func SafeFilePath(str string) string
- func SafeHTML(str string) string
- func Sleep1ms()
- func Sleep1s()
- func Sleep1sN(n uint8)
- func Sleep10ms()
- func Sleep10msN(n uint8)
- func Sleep50ms()
- func Sleep100ms()
- func Sleep100msN(n uint8)
- func SleepR()
- func SleepRand(lower int, upper int)
- func ToBase36(val uint64) string
- func UserExists(name string) bool
- func ValidArch(arch string) bool
- type FileMode
Constants ¶
const ( Arch_x86_64 = "x86_64" Arch_ARM = "arm" Arch_ARM64 = "arm64" Arch_RISC = "risc" Arch_PPC = "ppc" )
Variables ¶
var (
ErrFailGetUser = Errs.New("Failed to get current user")
)
var (
ErrFailedLoadConfig = Errs.New("Failed to load config")
)
var (
ErrInvalidColor = Errs.New("Invalid color")
)
var (
ErrInvalidSizeFormat = Errs.New("Invalid size format")
)
var (
ErrInvalidUid = Errs.New("Invalid UID value")
)
Functions ¶
func AnyToString ¶
func ColorHexPercent ¶
func ExpandPath ¶
func FileModeToStr0xxx ¶
func FormatByteSize ¶
func FormatByteSizeString ¶
func FromBase36 ¶
func GetExecPath ¶
func GetExecPath() string
func GetGroupID ¶
func GetHostName ¶
func GetHostName() string
func GetNevra ¶
func GetNevra(name string, version string, epoch uint16, release uint16, os string, arch string) string
name-[epoch_]version[-release][-os][-arch]
func GetRunPath ¶
func GetRunPath() string
func GroupExists ¶
func IsExisting ¶
func IsRootUser ¶
func IsSafeAlpha ¶
func IsSafeAlphaLower ¶
func IsSafeAlphaNum ¶
func IsSafeAlphaUpper ¶
func IsSafeDomain ¶
func IsSafeDomainPort ¶
func IsSafeFilePath ¶
func LoadConfig ¶
func ParseBoolDef ¶
func ParseByteSize ¶
func ParseNevra ¶
func SafeFilePath ¶
func Sleep10msN ¶
func Sleep10msN(n uint8)
func Sleep100ms ¶
func Sleep100ms()
func Sleep100msN ¶
func Sleep100msN(n uint8)