utils

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2019 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Nanosecond  = int64(time.Nanosecond) // Nanosecond
	Microsecond = 1000 * Nanosecond      // Nanosecond
	Millisecond = 1000 * Microsecond     // Nanosecond
	Second      = 1000 * Millisecond     // Nanosecond
	Minute      = 60 * Second            // Nanosecond
	Hour        = 60 * Minute            // Nanosecond
	Day         = 24 * Hour              // Nanosecond
	Year        = 365 * Day              // Nanosecond

	SecondsPerYear   = Year / Second   // Second
	SecondsPerDay    = Day / Second    // Second
	SecondsPerHour   = Hour / Second   // Second
	SecondsPerMinute = Minute / Second // Second

	MillisecondsPerYear   = Year / Millisecond   // Millisecond
	MillisecondsPerDay    = Day / Millisecond    // Millisecond
	MillisecondsPerHour   = Hour / Millisecond   // Millisecond
	MillisecondsPerMinute = Minute / Millisecond // Millisecond
	MillisecondsPerSecond = Second / Millisecond // Millisecond

	MicrosecondsPerYear        = Year / Microsecond        // Microsecond
	MicrosecondsPerDay         = Day / Microsecond         // Microsecond
	MicrosecondsPerHour        = Hour / Microsecond        // Microsecond
	MicrosecondsPerMinute      = Minute / Microsecond      // Microsecond
	MicrosecondsPerSecond      = Second / Microsecond      // Microsecond
	MicrosecondsPerMillisecond = Millisecond / Microsecond // Microsecond
)

Variables

This section is empty.

Functions

func DGetCurrentTime

func DGetCurrentTime(layout string) string

func Dump

func Dump(name string) (*os.File, error)

func Duration

func Duration(d int64) time.Duration

func Exists

func Exists(p string) bool

func FormatMemStats

func FormatMemStats(m1, m2 *runtime.MemStats) string

func FromLocalDateToSecond

func FromLocalDateToSecond(v string) int64

func FromSecondToLocalDate

func FromSecondToLocalDate(v int64) string

func FromTime2TimeInt

func FromTime2TimeInt(t time.Time) int

func FuncName

func FuncName(skip int) string

func GetCurrentMicrosecond

func GetCurrentMicrosecond() int64

func GetCurrentMillisecond

func GetCurrentMillisecond() int64

func GetCurrentNanosecond

func GetCurrentNanosecond() int64

func GetCurrentSecond

func GetCurrentSecond() int64

func GetCurrentTime

func GetCurrentTime() string

func GetLocalIP

func GetLocalIP() string

func GetRealIP

func GetRealIP(request *http.Request) (string, error)

func HumanSize

func HumanSize(s uint64) string

func IsEmpty

func IsEmpty(dir string) (bool, error)
func IsLink(p string) (bool, error)

func IsLocalIP

func IsLocalIP(request *http.Request) (bool, error)

IsLocalIP, 检查是否为本地 IP

func IsSameDay

func IsSameDay(t1, t2 time.Time) bool

func IsSameDayWithTimestamp

func IsSameDayWithTimestamp(d1, d2 int64) bool

func ListDir

func ListDir(dir string) ([]string, error)

func LoadJsonToObject

func LoadJsonToObject(filename string, t interface{}) error

func Marshal

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

no escape html

func ParseJSON

func ParseJSON(path string, v interface{}) error

func ReviewDumpPanic

func ReviewDumpPanic(file *os.File) error

func RuntimeStats

func RuntimeStats(d time.Duration, f func(string))

get runtime stats,contained goroutine numbers,gc pause,heap objects,heap alloc and malloc

func Sleep

func Sleep(millisecond int64)

func SplitTimeInt

func SplitTimeInt(t int) (year, month, day int)

Types

This section is empty.

Jump to

Keyboard shortcuts

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