Documentation ¶
Index ¶
- Variables
- func BinarySearch(a []string, v interface{}) int
- func BuildFormatString(format string, a ...any) string
- func BuildString(a ...any) string
- func BytesToInt[T int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64](bytesArr []byte) T
- func BytesToIntEndian[T int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64](bytesArr []byte, endian Endian) T
- func BytesToString(b []byte) string
- func Collect[T any, V any](source []T, fn func(one T) V) []V
- func Copy[T any](src *T) *T
- func CopyArray[T any](src []any, dest []T) []T
- func DecodeByte(b []byte, start int) (byte, error)
- func DecodeUint16(b []byte, start int) (uint16, error)
- func DecodeUint32(b []byte, start int) (uint32, error)
- func ElmType(value reflect.Value) reflect.Type
- func EncodeUint16(i uint16) []byte
- func EncodeUint32(i uint32) []byte
- func EndsWith(s []byte, target []byte) bool
- func GetBool(s string) (bool, error)
- func GetBool2(s string, defaultValue bool) bool
- func GetConnIP4(c net.Conn) net.IP
- func GetFloat(s string) (float64, error)
- func GetFloat2(s string, defaultValue float64) float64
- func GetIPv4ByInterface(name string) ([]string, error)
- func GetITime(s string, layout string, defaultValue *time.Time) *time.Time
- func GetInt(s string) (int64, error)
- func GetInt2(s string, defaultValue int64) int64
- func GetMapValue[K Keyable, T any](m map[K]T, key K) T
- func GetMapValue2[K Keyable, T any](m map[K]T, key K, defaultValue T) T
- func GetRandomUUID() string
- func GetUint(s string) (uint64, error)
- func GetUint2(s string, defaultValue uint64) uint64
- func GetUint32IP(c net.Conn) uint32
- func GroupBy[T any, K Keyable](source []T, fn func(one T) K) map[K][]T
- func GuessIP(remote string) *string
- func IP(ip string) string
- func InsertAt[T any](list []T, idx int, t T) []T
- func Int64ToStr(i int64) string
- func IntToBytes[T int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64](intNum T) []byte
- func IntToBytesEndian[T int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64](intNum T, endian Endian) []byte
- func Ip2uint32(ip net.IP) uint32
- func IsEmpty(str string) bool
- func IsNull[T any](v1 *T, fn func() T) T
- func IsUTF8(p []byte) bool
- func LeftPad(str string, limit int, placeholder rune) string
- func LocalIPv4s() ([]string, error)
- func MD5(data string) string
- func Map[T any, K Keyable](source []T, fn func(T) K) map[K]T
- func MapStream[T any, K Keyable](source map[K]T, fn func(K, T))
- func NewInstanceValue(t reflect.Type) reflect.Value
- func Null2Default[T any](v1 *T, v2 T) T
- func ParseParameterName(str string) []string
- func ParseURL(url string) (schema, host, query string, rtnErr error)
- func PrintSlice[T any](b []T)
- func RandRune() rune
- func RandRune2(s, e rune) rune
- func ReadMachineID() []byte
- func Reduce[T any, R any](source []T, fn func(one T) (R, bool)) []R
- func ReleasePerIPConn(c *PerIPConn)
- func RemoveAt[T any](list []T, idx int) []T
- func ReplaceAt[T any](list []T, idx int, t T) []T
- func ReplaceIP(address, ip string) string
- func ReplaceParameterValue(str string, keyAndValue map[string]string) string
- func ReplaceParameterWithKeyValue(str string, keyAndValue map[string]string) string
- func ReplacePort(address, port string) string
- func Reverse[T any](source []T) []T
- func RightPad(str string, limit int, placeholder rune) string
- func SaltMd5(data, salt string) string
- func SetUnExportFieldValue[T any](obj *T, field string, data any) (rtnErr error)
- func SplitHostPort(address string) (host, port string, err error)
- func StartsWith(s []byte, target []byte) bool
- func Str2Bool(source string) (any, error)
- func Str2Float32(source string) (any, error)
- func Str2Float64(source string) (any, error)
- func Str2Int(source string) (any, error)
- func Str2Int16(source string) (any, error)
- func Str2Int32(source string) (any, error)
- func Str2Int64(source string) (any, error)
- func Str2Int8(source string) (any, error)
- func Str2Object(v string, k reflect.Kind) (any, error)
- func Str2UInt64(source string) (any, error)
- func Str2Uint(source string) (any, error)
- func Str2Uint16(source string) (any, error)
- func Str2Uint32(source string) (any, error)
- func Str2Uint8(source string) (any, error)
- func StrNumSuffixInt(str string, mult int) int
- func Stream[T any](source []T, fn func(one T))
- func String(obj any) string
- func StringToBytes(s string) (b []byte)
- func Substring(source string, start int, end int) string
- func Type2Str(t reflect.Type) (string, error)
- func TypeOf(obj any) reflect.Type
- func Uint322ip(ip uint32) net.IP
- func Values[T any, K Keyable](source map[K]T) []T
- type DeString
- type Dimension
- type Endian
- type Keyable
- type Numeric
- type PerIPConn
- type PerIPConnCounter
- type RegExpError
Constants ¶
This section is empty.
Variables ¶
var ArrayOverFlow = errors.New("ArrayOverFlow")
var Counter uint32
var MachineID = ReadMachineID()
var Pid = os.Getpid()
var RegExpPool = make(regExpPool)
Functions ¶
func BinarySearch ¶
func BuildFormatString ¶
func BuildString ¶
func BytesToInt ¶ added in v1.0.20
func BytesToInt[T int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64](bytesArr []byte) T
BytesToInt 将以Big端存储的长为1/2字节的数转化成int类型的数
func BytesToIntEndian ¶ added in v1.0.20
func BytesToString ¶ added in v1.0.32
BytesToString converts byte slice to a string without memory allocation.
Note it may break if the implementation of string or slice header changes in the future go versions.
func EncodeUint16 ¶ added in v1.0.43
func EncodeUint32 ¶ added in v1.0.43
func GetIPv4ByInterface ¶ added in v1.0.4
GetIPv4ByInterface return IPv4 address from a specific interface IPv4 addresses
func GetMapValue ¶ added in v1.0.28
func GetMapValue2 ¶ added in v1.0.28
func GetRandomUUID ¶ added in v1.0.43
func GetRandomUUID() string
func GetUint32IP ¶ added in v1.0.33
func IntToBytes ¶ added in v1.0.20
func IntToBytes[T int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64](intNum T) []byte
IntToBytes 将int类型的数转化为字节并以Big端存储
func IntToBytesEndian ¶ added in v1.0.20
func IntToBytesEndian[T int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64](intNum T, endian Endian) []byte
IntToBytesEndian 将int类型的数转化为字节并以Big端存储
func LocalIPv4s ¶ added in v1.0.4
LocalIPv4s 获取本地内网ip LocalIPs return all non-loopback IPv4 addresses
func Null2Default ¶ added in v1.0.43
func Null2Default[T any](v1 *T, v2 T) T
func ParseParameterName ¶
func PrintSlice ¶ added in v1.0.41
func PrintSlice[T any](b []T)
func ReadMachineID ¶ added in v1.0.43
func ReadMachineID() []byte
func ReleasePerIPConn ¶ added in v1.0.33
func ReleasePerIPConn(c *PerIPConn)
func ReplaceParameterValue ¶
func ReplacePort ¶ added in v1.0.17
func SetUnExportFieldValue ¶ added in v1.0.21
func SplitHostPort ¶ added in v1.0.16
func StartsWith ¶ added in v1.0.41
func Str2Float32 ¶
func Str2Float64 ¶
func Str2UInt64 ¶
func Str2Uint16 ¶
func Str2Uint32 ¶
func StrNumSuffixInt ¶
StrNumSuffixInt Parse a number with K/M/G suffixes based on thousands (1000) or 2^10 (1024)
func StringToBytes ¶ added in v1.0.32
StringToBytes converts string to a byte slice without memory allocation.
Note it may break if the implementation of string or slice header changes in the future go versions.
Types ¶
type Dimension ¶ added in v1.0.24
type PerIPConn ¶ added in v1.0.33
func AcquirePerIPConn ¶ added in v1.0.33
func AcquirePerIPConn(conn net.Conn, ip uint32, counter *PerIPConnCounter) *PerIPConn
type PerIPConnCounter ¶ added in v1.0.33
type PerIPConnCounter struct {
// contains filtered or unexported fields
}
func (*PerIPConnCounter) Register ¶ added in v1.0.33
func (cc *PerIPConnCounter) Register(ip uint32) int
func (*PerIPConnCounter) Unregister ¶ added in v1.0.33
func (cc *PerIPConnCounter) Unregister(ip uint32)
type RegExpError ¶ added in v1.0.13
type RegExpError struct { }
func (RegExpError) Error ¶ added in v1.0.13
func (e RegExpError) Error() string