vRp.CD2g_test/utils/generic/README.md

4.2 KiB
Raw Blame History

Generic

Go doc

generic 目的在于提供一组基于泛型的用于处理通用功能的函数和数据结构。该包旨在简化通用功能的实现,并提供一致的接口和易于使用的功能。 主要特性:

  • 通用功能generic 包支持处理各种通用功能,如数据结构操作、算法实现和常用工具等。您可以使用这些功能来解决各种通用问题,并提高代码的复用性和可维护性。

目录导航

列出了该 package 下所有的函数及类型定义,可通过目录导航进行快捷跳转 ❤️

展开 / 折叠目录导航

包级函数定义

函数名称 描述
IsNil 检查指定的值是否为 nil
IsAllNil 检查指定的值是否全部为 nil
IsHasNil 检查指定的值是否存在 nil

类型定义

类型 名称 描述
INTERFACE IdR 暂无描述...
INTERFACE IDR 暂无描述...
INTERFACE IdW 暂无描述...
INTERFACE IDW 暂无描述...
INTERFACE IdR2W 暂无描述...
INTERFACE IDR2W 暂无描述...
INTERFACE Ordered 可排序类型
INTERFACE Number 数字类型
INTERFACE SignedNumber 有符号数字类型
INTERFACE Integer 整数类型
INTERFACE Signed 有符号整数类型
INTERFACE Unsigned 无符号整数类型
INTERFACE UnsignedNumber 无符号数字类型
INTERFACE Float 浮点类型
INTERFACE Basic 基本类型

详情信息

func IsNil[V any](v V) bool

检查指定的值是否为 nil


func IsAllNil[V any](v ...V) bool

检查指定的值是否全部为 nil


func IsHasNil[V any](v ...V) bool

检查指定的值是否存在 nil


IdR INTERFACE

type IdR[ID comparable] interface {
	GetId() ID
}

IDR INTERFACE

type IDR[ID comparable] interface {
	GetID() ID
}

IdW INTERFACE

type IdW[ID comparable] interface {
	SetId(id ID)
}

IDW INTERFACE

type IDW[ID comparable] interface {
	SetID(id ID)
}

IdR2W INTERFACE

type IdR2W[ID comparable] interface {
	IdR[ID]
	IdW[ID]
}

IDR2W INTERFACE

type IDR2W[ID comparable] interface {
	IDR[ID]
	IDW[ID]
}

Ordered INTERFACE

可排序类型

type Ordered interface {
	Integer | Float | ~string
}

Number INTERFACE

数字类型

type Number interface {
	Integer | Float
}

SignedNumber INTERFACE

有符号数字类型

type SignedNumber interface {
	Signed | Float
}

Integer INTERFACE

整数类型

type Integer interface {
	Signed | Unsigned
}

Signed INTERFACE

有符号整数类型

type Signed interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64
}

Unsigned INTERFACE

无符号整数类型

type Unsigned interface {
	UnsignedNumber | ~uintptr
}

UnsignedNumber INTERFACE

无符号数字类型

type UnsignedNumber interface {
	~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64
}

Float INTERFACE

浮点类型

type Float interface {
	~float32 | ~float64
}

Basic INTERFACE

基本类型

type Basic interface {
	Signed | Unsigned | Float | ~string | ~bool | ~byte
}