cast

package
v0.0.0-...-20d904f Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 16 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes2String

func Bytes2String(b []byte) string

func BytesToString

func BytesToString(b []byte) string

func ConvertAssign

func ConvertAssign(dest, src interface{}) error

func FloatToStr

func FloatToStr(f float64, precise ...int) string

func FormatFloat

func FormatFloat(f float64, precise ...int) string

func FormatFloat32

func FormatFloat32(f float32, precise ...int) string

func FromUTF8

func FromUTF8(sourceString string, charset string) string

func GbkToUtf8

func GbkToUtf8(bs []byte) ([]byte, error)

func GetSysTimeLayout

func GetSysTimeLayout() string

func LockAtom

func LockAtom()

func MapStringToValue

func MapStringToValue[T any](m map[string]interface{}, key string) T

func String2Bytes

func String2Bytes(s string) []byte

func StringToBytes

func StringToBytes(s string) []byte

func ToBool

func ToBool(v interface{}, defaultValue ...bool) (bool, error)

func ToBoolValue

func ToBoolValue(v interface{}, defaultValue ...bool) bool

func ToFloat32

func ToFloat32(v interface{}, defaultValue ...float32) (float32, error)

func ToFloat32Value

func ToFloat32Value(v interface{}, defaultValue ...float32) float32

func ToFloat64

func ToFloat64(v interface{}, defaultValue ...float64) (float64, error)

func ToFloat64Value

func ToFloat64Value(v interface{}, defaultValue ...float64) float64

func ToInt

func ToInt(v interface{}, defaultValue ...int) (int, error)

func ToInt64

func ToInt64(v interface{}, defaultValue ...int64) (int64, error)

func ToInt64Value

func ToInt64Value(v interface{}, defaultValue ...int64) int64

func ToIntValue

func ToIntValue(v interface{}, defaultValue ...int) int

func ToMapStringInterface

func ToMapStringInterface(v interface{}) (map[string]interface{}, bool)

func ToString

func ToString(v interface{}, defaultValue ...string) (string, error)

func ToStringValue

func ToStringValue(v interface{}, defaultValue ...string) string

func ToUTF8

func ToUTF8(sourceString string, charset string) string

func U16ToU8

func U16ToU8(data []byte) ([]byte, error)

func U8ToU16

func U8ToU16(data []byte, bigEndian bool) ([]byte, error)

func UnicodeStringToUtf8

func UnicodeStringToUtf8(raw string) (string, error)

func UnicodeToString

func UnicodeToString(data []byte) string

func UnicodeToUtf8

func UnicodeToUtf8(u16 []byte) string

func UnlockAtom

func UnlockAtom()

func Utf8ToGbk

func Utf8ToGbk(bs []byte) ([]byte, error)

Types

type Bool

type Bool struct {
	atomic.Bool
}

func (*Bool) Get

func (me *Bool) Get() bool

func (*Bool) Set

func (me *Bool) Set(v bool) bool

type Int

type Int struct {
	atomic.Int32
}

func (*Int) Dec

func (me *Int) Dec() int32

func (*Int) Get

func (me *Int) Get() int32

func (*Int) Inc

func (me *Int) Inc() int32

func (*Int) Set

func (me *Int) Set(v int32) int32

func (*Int) ToString

func (me *Int) ToString() string

type Int64

type Int64 struct {
	atomic.Int64
}

func (*Int64) Dec

func (me *Int64) Dec() int64

func (*Int64) Get

func (me *Int64) Get() int64

func (*Int64) Inc

func (me *Int64) Inc() int64

func (*Int64) Set

func (me *Int64) Set(v int64) int64

func (*Int64) ToString

func (me *Int64) ToString() string

type RawBytes

type RawBytes []byte

type String

type String struct {
	atomic.Pointer[string]
}

func (*String) Get

func (me *String) Get() string

func (*String) Set

func (me *String) Set(v string) string

type UInt

type UInt struct {
	atomic.Uint32
}

func (*UInt) Dec

func (me *UInt) Dec() uint32

func (*UInt) Get

func (me *UInt) Get() uint32

func (*UInt) Inc

func (me *UInt) Inc() uint32

func (*UInt) Set

func (me *UInt) Set(v uint32) uint32

func (*UInt) ToString

func (me *UInt) ToString() string

type UInt16

type UInt16 struct {
	atomic.Uint32
}

func (*UInt16) Add

func (me *UInt16) Add(v uint16) uint16

func (*UInt16) Dec

func (me *UInt16) Dec() uint16

func (*UInt16) Get

func (me *UInt16) Get() uint16

func (*UInt16) Inc

func (me *UInt16) Inc() uint16

func (*UInt16) Set

func (me *UInt16) Set(v uint16) uint16

func (*UInt16) ToString

func (me *UInt16) ToString() string

type UInt64

type UInt64 struct {
	atomic.Uint64
}

func (*UInt64) Dec

func (me *UInt64) Dec() uint64

func (*UInt64) Get

func (me *UInt64) Get() uint64

func (*UInt64) Inc

func (me *UInt64) Inc() uint64

func (*UInt64) Set

func (me *UInt64) Set(v uint64) uint64

func (*UInt64) ToString

func (me *UInt64) ToString() string

Jump to

Keyboard shortcuts

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