ekit

package module
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 5 Imported by: 9

README

ekit

泛型工具库。

交流

交流群。原本我是觉得有一个群会削弱 github 的社区氛围,但是比较多人还是习惯于用群交流,所以我也搞了一个。

但是希望你进群之前要先想好,这个群并不希望大家讨论任何的社会议题,包括政治、历史、男女、情感等。我们希望这个群承担的功能是讨论技术问题和技术互助。

技术互助的意思是,你进群是希望有人来帮你解答问题;那么同样地,看到别人提问,也希望你能帮助解答。

入群

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComparatorRealNumber

func ComparatorRealNumber[T RealNumber](src T, dst T) int

func ToPtr

func ToPtr[T any](t T) *T

Types

type AnyValue

type AnyValue struct {
	Val any
	Err error
}

AnyValue 类型转换结构定义

func (AnyValue) AsBytes added in v0.0.8

func (av AnyValue) AsBytes() ([]byte, error)

func (AnyValue) AsFloat32 added in v0.0.8

func (av AnyValue) AsFloat32() (float32, error)

func (AnyValue) AsFloat64 added in v0.0.8

func (av AnyValue) AsFloat64() (float64, error)

func (AnyValue) AsInt added in v0.0.8

func (av AnyValue) AsInt() (int, error)

func (AnyValue) AsInt16 added in v0.0.8

func (av AnyValue) AsInt16() (int16, error)

func (AnyValue) AsInt32 added in v0.0.8

func (av AnyValue) AsInt32() (int32, error)

func (AnyValue) AsInt64 added in v0.0.8

func (av AnyValue) AsInt64() (int64, error)

func (AnyValue) AsInt8 added in v0.0.8

func (av AnyValue) AsInt8() (int8, error)

func (AnyValue) AsString added in v0.0.8

func (av AnyValue) AsString() (string, error)

func (AnyValue) AsUint added in v0.0.8

func (av AnyValue) AsUint() (uint, error)

func (AnyValue) AsUint16 added in v0.0.8

func (av AnyValue) AsUint16() (uint16, error)

func (AnyValue) AsUint32 added in v0.0.8

func (av AnyValue) AsUint32() (uint32, error)

func (AnyValue) AsUint64 added in v0.0.8

func (av AnyValue) AsUint64() (uint64, error)

func (AnyValue) AsUint8 added in v0.0.8

func (av AnyValue) AsUint8() (uint8, error)

func (AnyValue) Bool

func (av AnyValue) Bool() (bool, error)

Bool 返回 bool 数据

func (AnyValue) BoolOrDefault

func (av AnyValue) BoolOrDefault(def bool) bool

BoolOrDefault 返回 bool 数据,或者默认值

func (AnyValue) Bytes

func (av AnyValue) Bytes() ([]byte, error)

Bytes 返回 []byte 数据

func (AnyValue) BytesOrDefault

func (av AnyValue) BytesOrDefault(def []byte) []byte

BytesOrDefault 返回 []byte 数据,或者默认值

func (AnyValue) Float32

func (av AnyValue) Float32() (float32, error)

Float32 返回 float32 数据

func (AnyValue) Float32OrDefault

func (av AnyValue) Float32OrDefault(def float32) float32

Float32OrDefault 返回 float32 数据,或者默认值

func (AnyValue) Float64

func (av AnyValue) Float64() (float64, error)

Float64 返回 float64 数据

func (AnyValue) Float64OrDefault

func (av AnyValue) Float64OrDefault(def float64) float64

Float64OrDefault 返回 float64 数据,或者默认值

func (AnyValue) Int

func (av AnyValue) Int() (int, error)

Int 返回 int 数据

func (AnyValue) Int16 added in v0.0.8

func (av AnyValue) Int16() (int16, error)

func (AnyValue) Int16OrDefault added in v0.0.8

func (av AnyValue) Int16OrDefault(def int16) int16

func (AnyValue) Int32

func (av AnyValue) Int32() (int32, error)

Int32 返回 int32 数据

func (AnyValue) Int32OrDefault

func (av AnyValue) Int32OrDefault(def int32) int32

Int32OrDefault 返回 int32 数据,或者默认值

func (AnyValue) Int64

func (av AnyValue) Int64() (int64, error)

Int64 返回 int64 数据

func (AnyValue) Int64OrDefault

func (av AnyValue) Int64OrDefault(def int64) int64

Int64OrDefault 返回 int64 数据,或者默认值

func (AnyValue) Int8 added in v0.0.8

func (av AnyValue) Int8() (int8, error)

func (AnyValue) Int8OrDefault added in v0.0.8

func (av AnyValue) Int8OrDefault(def int8) int8

func (AnyValue) IntOrDefault

func (av AnyValue) IntOrDefault(def int) int

IntOrDefault 返回 int 数据,或者默认值

func (AnyValue) JSONScan added in v0.0.9

func (av AnyValue) JSONScan(val any) error

JSONScan 将 val 转化为一个对象

func (AnyValue) String

func (av AnyValue) String() (string, error)

String 返回 string 数据

func (AnyValue) StringOrDefault

func (av AnyValue) StringOrDefault(def string) string

StringOrDefault 返回 string 数据,或者默认值

func (AnyValue) Uint

func (av AnyValue) Uint() (uint, error)

Uint 返回 uint 数据

func (AnyValue) Uint16 added in v0.0.8

func (av AnyValue) Uint16() (uint16, error)

func (AnyValue) Uint16OrDefault added in v0.0.8

func (av AnyValue) Uint16OrDefault(def uint16) uint16

func (AnyValue) Uint32

func (av AnyValue) Uint32() (uint32, error)

Uint32 返回 uint32 数据

func (AnyValue) Uint32OrDefault

func (av AnyValue) Uint32OrDefault(def uint32) uint32

Uint32OrDefault 返回 uint32 数据,或者默认值

func (AnyValue) Uint64

func (av AnyValue) Uint64() (uint64, error)

Uint64 返回 uint64 数据

func (AnyValue) Uint64OrDefault

func (av AnyValue) Uint64OrDefault(def uint64) uint64

Uint64OrDefault 返回 uint64 数据,或者默认值

func (AnyValue) Uint8 added in v0.0.8

func (av AnyValue) Uint8() (uint8, error)

func (AnyValue) Uint8OrDefault added in v0.0.8

func (av AnyValue) Uint8OrDefault(def uint8) uint8

func (AnyValue) UintOrDefault

func (av AnyValue) UintOrDefault(def uint) uint

UintOrDefault 返回 uint 数据,或者默认值

type Comparator

type Comparator[T any] func(src T, dst T) int

Comparator 用于比较两个对象的大小 src < dst, 返回-1,src = dst, 返回0,src > dst, 返回1 不要返回任何其它值!

type Number

type Number interface {
	RealNumber | ~complex64 | ~complex128
}

type RealNumber

type RealNumber interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 |
		~int | ~int8 | ~int16 | ~int32 | ~int64 |
		~float32 | ~float64
}

RealNumber 实数 绝大多数情况下,你都应该用这个来表达数字的含义

Directories

Path Synopsis
bean
internal
slice
Package slice 后续逐步把切片会在不同部分使用的公共方法挪过来这个内部包
Package slice 后续逐步把切片会在不同部分使用的公共方法挪过来这个内部包
net
tuple

Jump to

Keyboard shortcuts

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