utils

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CPUID

func CPUID() string

CPUID unique cpu id

func Daemon added in v0.1.2

func Daemon(nochdir, noclose int) int

Daemon process

func Exists

func Exists(path string) bool

Exists files

func FileMd5

func FileMd5(file string) string

FileMd5 calc file md5

func GetFuncName

func GetFuncName(f interface{}) string

GetFuncName return func name

func GetLocalIP

func GetLocalIP() (string, error)

GetLocalIP return local ip

func IsDir

func IsDir(path string) bool

IsDir check

func IsFile

func IsFile(path string) bool

IsFile check

func Md5

func Md5(str string) string

Md5 for string

func RandomIP

func RandomIP() string

RandomIP ip address

func RandomStr

func RandomStr(len int) string

RandomStr random str

func ResetColor added in v0.1.2

func ResetColor()

ResetColor reset terminal color

func URLJoin

func URLJoin(base, href string) string

URLJoin join urls

func UUID

func UUID() string

UUID unique id

Types

type Counter added in v0.1.2

type Counter struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Counter exported

func (*Counter) Delete added in v0.1.2

func (c *Counter) Delete(key string)

Delete exported

func (*Counter) Get added in v0.1.2

func (c *Counter) Get(key string) int

Get exported

func (*Counter) Incr added in v0.1.2

func (c *Counter) Incr(key string, amount int) int

Incr exported

func (*Counter) Set added in v0.1.2

func (c *Counter) Set(key string, value int)

Set exported

type Map

type Map struct {
	sync.Map
	// contains filtered or unexported fields
}

Map sync map

func (*Map) Incr

func (m *Map) Incr(key string, amount int)

Incr map

type Storage added in v0.1.1

type Storage struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Storage define

func NewStorage added in v0.1.1

func NewStorage() *Storage

NewStorage return new storage

func (*Storage) Delete added in v0.1.1

func (s *Storage) Delete(key string)

Delete key by key

func (*Storage) Get added in v0.1.1

func (s *Storage) Get(key string) interface{}

Get value by key

func (*Storage) Reset added in v0.1.1

func (s *Storage) Reset()

Reset all keys

func (*Storage) Set added in v0.1.1

func (s *Storage) Set(key string, val interface{}, ttl time.Duration)

Set key with value

func (*Storage) TTL added in v0.1.1

func (s *Storage) TTL(key string) uint64

TTL return ttl

Jump to

Keyboard shortcuts

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