util

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DASH = "-"

Variables

This section is empty.

Functions

func CacheDir

func CacheDir() string

CacheDir 缓存

func GetEnvInt

func GetEnvInt(name string, def int) int

func GetEnvString

func GetEnvString(name string, def string) string

func GetUUID

func GetUUID() string

GetUUID generates a UUID/GUID (version 1 format) using the satori/go.uuid package

func GetUUIDv4

func GetUUIDv4() string

GetUUIDv4 generates a UUID/GUID (version 4 format) using the satori/go.uuid package

func HostName

func HostName() (hostname string)

func Int16ToInt64

func Int16ToInt64(bs []int16) (in int64)

func IsBigEndian

func IsBigEndian() bool

func IsLittleEndian

func IsLittleEndian() bool

func PathExist

func PathExist(path string) bool

func String

func String(length int) string

String supply rand string

func StringWithCharset

func StringWithCharset(length int, charset Charset) string

StringWithCharset support rand string you defined

Types

type Charset

type Charset string

Charset is string type

const (
	// Alphanumeric contain Alphabetic and Numeric
	Alphanumeric Charset = Alphabetic + Numeric
	// Alphabetic is \w+ \W
	Alphabetic Charset = "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	// Numeric is number list
	Numeric Charset = "0123456789"
	// Hex is Hexadecimal
	Hex Charset = Numeric + "abcdef"
)

type JSONObject

type JSONObject map[string]interface{}

func (JSONObject) Bool

func (c JSONObject) Bool(k interface{}, def bool) bool

func (JSONObject) Int

func (c JSONObject) Int(k interface{}, def int) int

func (JSONObject) Object

func (c JSONObject) Object(k interface{}) JSONObject

func (JSONObject) Set

func (c JSONObject) Set(k interface{}, v interface{}) JSONObject

func (JSONObject) String

func (c JSONObject) String(k interface{}, def string) string

type StringSlice

type StringSlice []string

StringSlice ...

func (StringSlice) Add

func (s StringSlice) Add(str string) ([]string, bool)

Add adds the str to the slice.

func (StringSlice) Has

func (s StringSlice) Has(str string) bool

Has returns whether the str is in the slice.

func (StringSlice) Remove

func (s StringSlice) Remove(str string) ([]string, bool)

Remove remove the str from the slice.

Directories

Path Synopsis
*
*

Jump to

Keyboard shortcuts

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