Documentation ¶
Index ¶
- Constants
- Variables
- func CommandLocal(name string, arg ...string) (string, error)
- func CommandSSH(session *ssh.Session, command string) (string, error)
- func FileFormatBytes(bytesize int64, sigfig ...int) string
- func ImageConfig(r io.Reader, ext string) (config image.Config, err error)
- func IntExplode(s, sep string) ([]int, error)
- func IntImplode(is []int, sep string) string
- func IsZero(v any) bool
- func NumberMax[T INumber](numbers []T) (T, error)
- func NumberMin[T INumber](numbers []T) (T, error)
- func NumberPercentage[T INumber](a, b T) float64
- func NumberPercentageString[T INumber](a, b T) string
- func Pointer[T any](any T) *T
- func Rand() string
- func RandID() string
- func RandomN(n int) string
- func RandomNumberN(length int) string
- func SSHLoginKey(hostAddr string, username string, privateKey []byte) (session *ssh.Session, err error)
- func SSHLoginPassword(hostAddr string, username string, password string) (*ssh.Session, error)
- func Seed(seed int64)
- func StringsReplaceMap(s string, repl map[string]string) string
- func TimeBetween(start, end time.Time, diff time.Duration) bool
- func TimeCalendar(start, end time.Time, ...)
- func Uniqid(prefixs ...string) string
- func ValidateStruct(obj any) error
- type INumber
- type ValidationErrors
- type Zeroer
Constants ¶
View Source
const ( // KB represents the size of a kilobyte. KB float64 = 1024 // MB represents the size of a megabyte. MB = 1024 * KB // GB represents the size of a gigabyte. GB = 1024 * MB // TB represents the size of a terabyte. TB = 1024 * GB // PB represents the size of a petabyte. PB = 1024 * TB )
View Source
const ( ImageExtJPG = ".jpg" ImageExtJPEG = ".jpeg" ImageExtGIF = ".gif" ImageExtPNG = ".png" ImageExtWEBP = ".webp" )
Variables ¶
View Source
var (
Validate = &validate{}
)
Functions ¶
func FileFormatBytes ¶
func ImageConfig ¶
ImageConfig fs, err := os.Open(imagePath) ext:=strings.ToLower(filepath.Ext(imagePath)) ImageConfig(fs,ext)
func IsZero ¶
IsZero reports whether "v" is zero value or no. The given "v" value can complete the Zeroer interface which can be used to customize the behavior for each type of "v".
func NumberPercentageString ¶
func RandomNumberN ¶
func SSHLoginKey ¶
func SSHLoginPassword ¶
func StringsReplaceMap ¶
StringsReplaceMap 您手机注册的验证码为:【变量1】,如有问题请拨打客服电话:【变量2】 repl = map[string]string{"变量1":"111","变量2"::"222"} 您手机注册的验证码为:111,如有问题请拨打客服电话:222
func TimeBetween ¶
TimeBetween 判断开始时间和结束时间是否小于等于diff
func TimeCalendar ¶
TimeCalendar 根据开始时间和结束时间生成期间每天的开始时间和结束时间
func ValidateStruct ¶
Types ¶
type ValidationErrors ¶
type ValidationErrors []error
func (ValidationErrors) Error ¶
func (err ValidationErrors) Error() string
Error concatenates all error elements in SliceValidationError into a single string separated by \n.
Click to show internal directories.
Click to hide internal directories.