ekit

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: Apache-2.0 Imports: 2 Imported by: 69 modules, 29 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

ekit

泛型工具库。

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) 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) 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) IntOrDefault

func (av AnyValue) IntOrDefault(def int) int

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

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) 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) 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 后续逐步把切片会在不同部分使用的公共方法挪过来这个内部包

Jump to

Keyboard shortcuts

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