u

package module
v0.5.32 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: MIT Imports: 24 Imported by: 91

README

utility

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalRand1 = rand.New(rand.NewSource(int64(time.Now().Nanosecond())))
View Source
var GlobalRand2 = rand.New(rand.NewSource(int64(time.Now().Unix())))

Functions

func AppendInt

func AppendInt(buf []byte, u uint64) []byte

func AppendUniqueString added in v0.1.17

func AppendUniqueString(to []string, from string) []string

func AppendUniqueStrings added in v0.1.17

func AppendUniqueStrings(to []string, from []string) []string

func BBlack

func BBlack(s interface{}, attribs ...AttribCode) string

func BBlue

func BBlue(s interface{}, attribs ...AttribCode) string

func BCyan

func BCyan(s interface{}, attribs ...AttribCode) string

func BGreen

func BGreen(s interface{}, attribs ...AttribCode) string

func BMagenta

func BMagenta(s interface{}, attribs ...AttribCode) string

func BRed

func BRed(s interface{}, attribs ...AttribCode) string

func BWhite

func BWhite(s interface{}, attribs ...AttribCode) string

func BYellow

func BYellow(s interface{}, attribs ...AttribCode) string

func Black

func Black(s interface{}, attribs ...AttribCode) string

func Blue

func Blue(s interface{}, attribs ...AttribCode) string

func Bool

func Bool(value interface{}) bool

func Bytes

func Bytes(value interface{}) []byte

func CheckPath added in v0.0.8

func CheckPath(fileName string)

func Color

func Color(s interface{}, textColor TextColor, bgColor BgColor, attribs ...AttribCode) string

func Convert added in v0.1.9

func Convert(from, to interface{})

func Copy added in v0.5.30

func Copy(fileName string, reader io.Reader) error

func Cyan

func Cyan(s interface{}, attribs ...AttribCode) string

func DecodeInt

func DecodeInt(buf []byte) uint64

func DecryptAes

func DecryptAes(crypted string, key []byte, iv []byte) (out string)

func DecryptAesBytes added in v0.1.17

func DecryptAesBytes(crypted string, key []byte, iv []byte) (out []byte)

func Dim added in v0.0.4

func Dim(s interface{}) string

func Duration added in v0.1.17

func Duration(value string) time.Duration

func EncodeInt

func EncodeInt(u uint64) []byte

func EncryptAes

func EncryptAes(origData string, key []byte, iv []byte) (out string)

func EncryptAesBytes added in v0.1.17

func EncryptAesBytes(origData []byte, key []byte, iv []byte) (out string)

func FileExists added in v0.0.8

func FileExists(fileName string) bool

func FillInt added in v0.1.17

func FillInt(buf []byte, length int) []byte

func FinalType added in v0.1.9

func FinalType(v reflect.Value) reflect.Type

func FinalValue added in v0.1.9

func FinalValue(v reflect.Value) reflect.Value

func FixNilValue added in v0.1.9

func FixNilValue(v reflect.Value)

func FixPath added in v0.1.17

func FixPath(path string) string

func FixUpperCase

func FixUpperCase(data []byte, excludesKeys []string)

func Float

func Float(value interface{}) float32

func Float64

func Float64(value interface{}) float64

func Floats

func Floats(value interface{}) []float64

func GetLowerName added in v0.1.9

func GetLowerName(s string) string

func GetUpperName added in v0.1.9

func GetUpperName(s string) string

func Green

func Green(s interface{}, attribs ...AttribCode) string

func Id10 added in v0.1.17

func Id10() string

约81亿亿

func Id12 added in v0.1.17

func Id12() string

约312303亿亿

func Id6 added in v0.1.17

func Id6() string

约 550亿

func Id8 added in v0.1.17

func Id8() string

约 2113536亿

func If

func If(i bool, a, b interface{}) interface{}

func In added in v0.1.8

func In(arr []interface{}, s interface{}) bool

func Int

func Int(value interface{}) int

func Int64

func Int64(value interface{}) int64

func Ints

func Ints(value interface{}) []int64

func Italic added in v0.0.4

func Italic(s interface{}) string

func JoinArgs added in v0.5.30

func JoinArgs(arr []string, sep string) string

func Json added in v0.1.6

func Json(value interface{}) string

func JsonP added in v0.1.6

func JsonP(value interface{}) string

func Load added in v0.0.8

func Load(fileName string, to interface{}) error

func LoadJson added in v0.1.13

func LoadJson(fileName string, to interface{}) error

func LoadX added in v0.5.30

func LoadX(fileName string, to interface{}) error

func LoadYaml added in v0.1.13

func LoadYaml(fileName string, to interface{}) error

func MD5 added in v0.1.17

func MD5(data []byte) []byte

func MD5Base64 added in v0.1.17

func MD5Base64(data string) string

func MD5String added in v0.1.17

func MD5String(data string) string

func Magenta

func Magenta(s interface{}, attribs ...AttribCode) string

func NewIntEncoder

func NewIntEncoder(digits string) (*intEncoder, error)

func ParseInt added in v0.1.9

func ParseInt(s string) int64

func ParseUint added in v0.1.9

func ParseUint(s string) uint64

func ReadFile added in v0.0.8

func ReadFile(fileName string, maxLen uint) (string, error)

func ReadFileBytes added in v0.5.30

func ReadFileBytes(fileName string, maxLen uint) ([]byte, error)

func ReadFileLines added in v0.1.15

func ReadFileLines(fileName string) ([]string, error)

func RealValue added in v0.1.9

func RealValue(v reflect.Value) reflect.Value

func Red

func Red(s interface{}, attribs ...AttribCode) string

func RunCommand added in v0.0.8

func RunCommand(command string, args ...string) ([]string, error)

func Save added in v0.0.8

func Save(fileName string, data interface{}) error

func SaveJson added in v0.1.13

func SaveJson(fileName string, data interface{}) error

func SaveJsonP added in v0.1.17

func SaveJsonP(fileName string, data interface{}) error

func SaveYaml added in v0.1.13

func SaveYaml(fileName string, data interface{}) error

func SetValue added in v0.1.17

func SetValue(to, from reflect.Value)

func Sha1 added in v0.1.17

func Sha1(data []byte) []byte

func Sha1Base64 added in v0.1.17

func Sha1Base64(data string) string

func Sha1String added in v0.1.17

func Sha1String(data string) string

func Sha256 added in v0.1.17

func Sha256(data []byte) []byte

func Sha256Base64 added in v0.1.17

func Sha256Base64(data string) string

func Sha256String added in v0.1.17

func Sha256String(data string) string

func Sha512 added in v0.1.17

func Sha512(data []byte) []byte

func Sha512Base64 added in v0.1.17

func Sha512Base64(data string) string

func Sha512String added in v0.1.17

func Sha512String(data string) string

func ShortUniqueId added in v0.0.10

func ShortUniqueId() string

func SplitArgs added in v0.5.30

func SplitArgs(s string) []string

func SplitTrim added in v0.1.12

func SplitTrim(s, sep string) []string

func SplitWithoutNone added in v0.1.17

func SplitWithoutNone(s, sep string) []string

func String

func String(value interface{}) string

func StringIf

func StringIf(i bool, a, b string) string

func StringIn added in v0.1.8

func StringIn(arr []string, s string) bool

func Strings

func Strings(value interface{}) []string

func Switch

func Switch(i uint, args ...interface{}) interface{}

func ToInterfaceArray added in v0.1.17

func ToInterfaceArray(in interface{}) []interface{}

func Uint added in v0.1.9

func Uint(value interface{}) uint

func Uint64 added in v0.1.9

func Uint64(value interface{}) uint64

func UniqueId

func UniqueId() string

func ValueToString added in v0.1.10

func ValueToString(v reflect.Value) string

func White

func White(s interface{}, attribs ...AttribCode) string

func WriteFile added in v0.1.15

func WriteFile(fileName string, content string) error

func WriteFileBytes added in v0.5.30

func WriteFileBytes(fileName string, content []byte) error

func Yellow

func Yellow(s interface{}, attribs ...AttribCode) string

Types

type AttribCode

type AttribCode int
const (
	AttrNone AttribCode = iota
	AttrBold
	AttrDim
	AttrItalic
	AttrUnderline
	AttrBlink
	AttrFastBlink
	AttrReverse
	AttrHidden
	AttrCrossedOut
)

type BgColor

type BgColor int
const (
	BgBlack BgColor = iota + 40
	BgRed
	BgGreen
	BgYellow
	BgBlue
	BgMagenta
	BgCyan
	BgWhite
	BgNone BgColor = 0
)

type TextColor

type TextColor int
const (
	TextBlack TextColor = iota + 30
	TextRed
	TextGreen
	TextYellow
	TextBlue
	TextMagenta
	TextCyan
	TextWhite
	TextNone TextColor = 0
)

Jump to

Keyboard shortcuts

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