util

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: MIT Imports: 7 Imported by: 80

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentTimestamp added in v0.0.41

func CurrentTimestamp() int64

CurrentTimestamp 返回当前的时间戳,基于1970-01-01_00:00:00,单位:ms

func Int64ToTime added in v0.0.66

func Int64ToTime(ms int64) time.Time

Int64ToTime 是 TimeToInt64 的反函数

func ParseHexString added in v0.1.4

func ParseHexString(hex string) ([]byte, error)

ParseHexString 解析hex形式的字符串,返回对应的 []byte

func PumpStream added in v0.0.66

func PumpStream(in io.Reader, out io.Writer, buffer []byte) error

PumpStream 从in读数据,并写到out,直到读到EOF

func StringifyBytes

func StringifyBytes(data []byte) string

StringifyBytes 是 ToHexString 的别名

func TimeToInt64 added in v0.0.66

func TimeToInt64(t time.Time) int64

TimeToInt64 返回 time.Time 的 int64(ms) 形式时间戳,基于1970-01-01_00:00:00,单位:ms

func ToHexString added in v0.1.4

func ToHexString(data []byte) string

ToHexString 把字节数组格式化为字符串(charset=0~9+abcdef)

Types

type Base64 added in v0.1.4

type Base64 string

Base64 表示字符串形式的 base64 值

func Base64FromBytes added in v0.1.4

func Base64FromBytes(b []byte) Base64

Base64FromBytes 转换 []byte ==> base64

func Base64FromHexString added in v0.1.4

func Base64FromHexString(hex Hex) Base64

Base64FromHexString 转换 hex string ==> base64

func Base64FromString added in v0.1.4

func Base64FromString(s string) Base64

Base64FromString 转换 b64 string ==> base64

func (Base64) Bytes added in v0.1.4

func (b Base64) Bytes() []byte

Bytes 转换为 bytes

func (Base64) HexString added in v0.1.4

func (b Base64) HexString() Hex

HexString 转换为16进制格式的字符串

func (Base64) String added in v0.1.4

func (b Base64) String() string

String 转换为base64格式的字符串

type ErrorBuilder added in v0.0.44

type ErrorBuilder struct {
	// contains filtered or unexported fields
}

ErrorBuilder 用来创建一个错误对象

func (*ErrorBuilder) Create added in v0.0.44

func (inst *ErrorBuilder) Create() error

Create 创建错误对象

func (*ErrorBuilder) InnerError added in v0.0.44

func (inst *ErrorBuilder) InnerError(inner error) *ErrorBuilder

InnerError 设置内嵌错误

func (*ErrorBuilder) Message added in v0.0.44

func (inst *ErrorBuilder) Message(msg string) *ErrorBuilder

Message 设置错误消息

func (*ErrorBuilder) Set added in v0.0.44

func (inst *ErrorBuilder) Set(name string, value string) *ErrorBuilder

Set 设置属性

type Hex added in v0.1.4

type Hex string

Hex 表示十六进制形式的字符串

func HexFromBytes added in v0.1.4

func HexFromBytes(b []byte) Hex

HexFromBytes 把字节数组转换成 hex

func HexFromString added in v0.1.4

func HexFromString(s string) (Hex, error)

HexFromString 把字符串转换成 hex

func (Hex) Bytes added in v0.1.4

func (h Hex) Bytes() []byte

Bytes 这个函数把 Hex 的值转换成字节数组

func (Hex) String added in v0.1.4

func (h Hex) String() string

String 这个函数把 Hex 的值转换成字符串

type PathBuilder added in v0.0.16

type PathBuilder struct {
	// contains filtered or unexported fields
}

func (*PathBuilder) AppendPath added in v0.0.16

func (inst *PathBuilder) AppendPath(path string) *PathBuilder

func (*PathBuilder) AppendSimpleName added in v0.0.16

func (inst *PathBuilder) AppendSimpleName(simpleName string) *PathBuilder

func (*PathBuilder) AppendSimpleNameList added in v0.0.16

func (inst *PathBuilder) AppendSimpleNameList(list []string) *PathBuilder

func (*PathBuilder) Create added in v0.0.16

func (inst *PathBuilder) Create(prefix string, suffix string) (string, error)

func (*PathBuilder) EnableRoot added in v0.0.16

func (inst *PathBuilder) EnableRoot(enable bool) *PathBuilder

func (*PathBuilder) EnableTrim added in v0.0.16

func (inst *PathBuilder) EnableTrim(enable bool) *PathBuilder

func (*PathBuilder) IgnoreDoubleDot added in v0.0.40

func (inst *PathBuilder) IgnoreDoubleDot(enable bool) *PathBuilder

func (*PathBuilder) SetSeparator added in v0.0.16

func (inst *PathBuilder) SetSeparator(sep string) *PathBuilder

func (*PathBuilder) String added in v0.0.16

func (inst *PathBuilder) String() string

type Time added in v0.1.3

type Time int64

Time 用 int64 表示的时间戳,类似java里面的 long System.currentTimeMillis()

func NewTime added in v0.1.3

func NewTime(t time.Time) Time

NewTime 根据参数创建对应的时间戳

func NewTimeWithInt64 added in v0.1.3

func NewTimeWithInt64(n int64) Time

NewTimeWithInt64 根据参数创建对应的时间戳

func Now added in v0.1.3

func Now() Time

Now 根据参数创建对应的时间戳

func (Time) GetTime added in v0.1.3

func (t Time) GetTime() time.Time

GetTime 转为 time.Time

func (Time) Int64 added in v0.1.3

func (t Time) Int64() int64

Int64 转为整形

func (Time) String added in v0.1.3

func (t Time) String() string

String 转为字符串

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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