go-admin: github.com/GoAdminGroup/go-admin/modules/utils Index | Files

package utils

import "github.com/GoAdminGroup/go-admin/modules/utils"


Package Files



const (
    Byte  = 1
    KByte = Byte * 1024
    MByte = KByte * 1024
    GByte = MByte * 1024
    TByte = GByte * 1024
    PByte = TByte * 1024
    EByte = PByte * 1024
const (
    Minute = 60
    Hour   = 60 * Minute
    Day    = 24 * Hour
    Week   = 7 * Day
    Month  = 30 * Day
    Year   = 12 * Month

Seconds-based time units

func AorB Uses

func AorB(condition bool, a, b string) string

func CompareVersion Uses

func CompareVersion(src, toCompare string) bool

func CompressedContent Uses

func CompressedContent(h *template.HTML)

func CopyMap Uses

func CopyMap(m map[string]string) map[string]string

func DownloadTo Uses

func DownloadTo(url, output string) error

func FileExist Uses

func FileExist(path string) bool

func FileSize Uses

func FileSize(s uint64) string

FileSize calculates the file size and generate user-friendly string.

func InArray Uses

func InArray(arr []string, str string) bool

func IsJSON Uses

func IsJSON(str string) bool

func JSON Uses

func JSON(a interface{}) string

func PackageName Uses

func PackageName(v interface{}) string

func ParseBool Uses

func ParseBool(s string) bool

func ParseFloat32 Uses

func ParseFloat32(f string) float32

func ParseTime Uses

func ParseTime(stringTime string) time.Time

func Random Uses

func Random(strings []string) ([]string, error)

func ReplaceNth Uses

func ReplaceNth(s, old, new string, n int) string

func SetDefault Uses

func SetDefault(value, condition, def string) string

func TimeSincePro Uses

func TimeSincePro(then time.Time, m map[string]string) string

TimeSincePro calculates the time interval and generate full user-friendly string.

func UnzipDir Uses

func UnzipDir(src, dest string) error

func Uuid Uses

func Uuid(length int64) string

func WrapURL Uses

func WrapURL(u string) string

Package utils imports 18 packages (graph) and is imported by 8 packages. Updated 2020-07-10. Refresh now. Tools for package owners.