utils

package
v0.0.0-...-f08b0e3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Arch

func Arch() string

Arch returns the current architecture

func FilePathJoin

func FilePathJoin(paths ...string) string

FilePathJoin joins file paths

func HTTPGet

func HTTPGet(url string) ([]byte, error)

HTTPGet makes a GET request to a URL

func IsEmpty

func IsEmpty(v interface{}) bool

IsEmpty checks if a string, slice, or map is empty

func IsNil

func IsNil(v interface{}) bool

IsNil checks if a value is nil

func JSONMarshal

func JSONMarshal(v interface{}) ([]byte, error)

JSONMarshal marshals a struct to JSON

func JSONUnmarshal

func JSONUnmarshal(data []byte, v interface{}) error

JSONUnmarshal unmarshals JSON to a struct

func OS

func OS() string

OS returns the current operating system

func RandInt

func RandInt(min, max int) int

RandInt generates a random integer

func RandString

func RandString(length int) string

RandString generates a random string of a given length

func RegexpMatch

func RegexpMatch(pattern, str string) bool

RegexpMatch checks if a string matches a regular expression

func TimeFormat

func TimeFormat(t time.Time, layout string) string

TimeFormat formats a time

func TimeNow

func TimeNow() time.Time

TimeNow returns the current time

func TimeParse

func TimeParse(layout, value string) (time.Time, error)

TimeParse parses a time string

func URLParse

func URLParse(rawURL string) (*url.URL, error)

URLParse parses a URL

func UUID

func UUID() (string, error)

UUID generates a random UUID

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL