gutil

package module
v0.0.0-...-eae795a Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2017 License: MIT Imports: 12 Imported by: 2

README

gutil

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesIndexOf

func BytesIndexOf(b, sub []byte) int

func CombineBytes

func CombineBytes(one []byte, others ...[]byte) []byte

func GetTodayInterval

func GetTodayInterval() (begin, end time.Time)

func HumanReadableByteCount

func HumanReadableByteCount(bytes int64, si bool) string

func JsonToString

func JsonToString(v interface{}) string

func ListenFileChanged

func ListenFileChanged(filepath string, v interface{}, notifyFuncs ...func(filepath string, v interface{}) error) bool

func ListenJsonFile

func ListenJsonFile(v interface{}, notifyFunc func(filepath string, v interface{}) error, filenames ...string) bool

func ListenTextFile

func ListenTextFile(notifyFunc func(filepath, content string) error, filepaths ...string) bool

func LoadJsonFile

func LoadJsonFile(v interface{}, notifyFunc func(filepath string, v interface{}) error, filepaths ...string) bool

func LoadTextFile

func LoadTextFile(notifyFunc func(filepath, content string) error, filepaths ...string) bool

func NewQueue

func NewQueue() *unsafeQueue

func NewSafeQueue

func NewSafeQueue() *safeQueue

func NewUuid

func NewUuid() string

func NowDate

func NowDate() time.Time

func RandIntn

func RandIntn(n int) int

func RemoveFileChangedListener

func RemoveFileChangedListener(filepath string)

func SmartSleep

func SmartSleep(d time.Duration, max time.Duration) time.Duration

func TimeNow

func TimeNow() *time.Time

func ToPerSecond

func ToPerSecond(total int64, duration time.Duration) int64

Types

type Map

type Map interface {
	Put(key interface{}, value interface{})
	Get(key interface{}, defaultValue ...interface{}) (value interface{})
	Remove(key interface{})
	Pick(key interface{}, defaultValue ...interface{}) (value interface{})
	Has(key interface{}) bool
	Range(f func(key interface{}, value interface{}))
	Size() int
	IsEmpty() bool
	Clear()
}

func NewMap

func NewMap() Map

func NewSafeMap

func NewSafeMap() Map

type Queue

type Queue interface {
	IsEmpty() bool
	Offers(a []interface{})
	Offer(v interface{})
	Poll() interface{}
	PollN(n int) []interface{}
	Peek() interface{}
	PeekN(n int) []interface{}
	Clear()
	Len() int
}

type Set

type Set interface {
	Add(item interface{})
	Remove(item interface{})
	Has(item interface{}) bool
	Range(f func(item interface{}))
	Slice() []interface{}
	Size() int
	IsEmpty() bool
	Clear()
}

func NewSafeSet

func NewSafeSet() Set

func NewSet

func NewSet() Set

Jump to

Keyboard shortcuts

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