constraints

package
v0.0.0-...-f5948c0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EqualFunc

func EqualFunc[T constraints.Ordered](t T, t2 T) bool

func FloatConvert

func FloatConvert[T, V constraints.Float](v V) T

func GreaterFunc

func GreaterFunc[T constraints.Ordered](t T, t2 T) bool

func IntegerConvert

func IntegerConvert[T, V constraints.Integer](v V) T

func LessFunc

func LessFunc[T constraints.Ordered](t T, t2 T) bool

func NumberConvert

func NumberConvert[T, V Number](v V) T

func SignedConvert

func SignedConvert[T, V constraints.Signed](v V) T

func UnsignedConvert

func UnsignedConvert[T, V constraints.Unsigned](v V) T

Types

type Basic

type Basic struct {
}

type Callback

type Callback[T any] interface {
	~func() | ~func() error | ~func(T) | ~func(T) error
}

type CmpKey

type CmpKey[T comparable] interface {
	CmpKey() T
}

type Compare

type Compare[T any] interface {
	Compare(T) bool
}

type CompareFunc

type CompareFunc[T any] func(T, T) bool

type Enum

type Enum[T constraints.Integer] int

type GRPCServiceMethod

type GRPCServiceMethod[REQ, RES any] func(context.Context, REQ) (RES, error)

type ID

type ID interface {
	constraints.Integer | ~string | ~[]byte | ~[8]byte | ~[16]byte
}

type Number

type Number interface {
	constraints.Integer | constraints.Float
}

type OrderKey

type OrderKey[T constraints.Ordered] interface {
	OrderKey() T
}

comparable 只能比较是否相等,不能比较大小

type Range

type Range interface {
	constraints.Ordered | time.Time | ~*time.Time | ~string
}

type Store

type Store[K, V any] interface {
	Set(k K, v V)
	Get(k K) V
}

type StoreWithExpire

type StoreWithExpire[K, V any] interface {
	Set(k K, v V, expire time.Duration)
	Get(k K) V
}

Jump to

Keyboard shortcuts

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