generic

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 1 Imported by: 0

README

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
}

Documentation

Overview

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

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAllNil added in v0.0.21

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

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

func IsHasNil added in v0.0.21

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

IsHasNil 检查指定的值是否存在 nil

func IsNil added in v0.0.3

func IsNil[V any](v V) bool

IsNil 检查指定的值是否为 nil

Types

type Basic added in v0.2.9

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

Basic 基本类型

type Float

type Float interface {
	~float32 | ~float64
}

Float 浮点类型

type IDR added in v0.2.7

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

type IDR2W added in v0.2.7

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

type IDW added in v0.2.7

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

type IdR added in v0.2.6

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

type IdR2W added in v0.2.7

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

type IdW added in v0.2.6

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

type Integer

type Integer interface {
	Signed | Unsigned
}

Integer 整数类型

type Number

type Number interface {
	Integer | Float
}

Number 数字类型

type Ordered

type Ordered interface {
	Integer | Float | ~string
}

Ordered 可排序类型

type Signed

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

Signed 有符号整数类型

type SignedNumber

type SignedNumber interface {
	Signed | Float
}

SignedNumber 有符号数字类型

type Unsigned

type Unsigned interface {
	UnsignedNumber | ~uintptr
}

Unsigned 无符号整数类型

type UnsignedNumber added in v0.3.6

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

UnsignedNumber 无符号数字类型

Jump to

Keyboard shortcuts

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