Documentation ¶
Index ¶
- func BoolToInt(b bool) int
- func CastFloat[T, V constraints.Float](v V) T
- func CastInteger[T, V constraints.Integer](v V) T
- func CastNumber[T, V constraintsi.Number](v V) T
- func CastSigned[T, V constraints.Signed](v V) T
- func CastUnsigned[T, V constraints.Unsigned](v V) T
- func Match[T any](yes bool, a, b T) T
- func ResultVal[T any](v T, err error) T
- func Zero[T any]() T
- func Zero2[T any]() T
- type Basic
- type BinaryFunction
- type BinaryKVFunction
- type BinaryKVFunction2
- type BinaryKVOperator
- type BinaryOperator
- type Bool
- func (b Bool) IsFalse() bool
- func (b Bool) IsNone() bool
- func (b Bool) IsTrue() bool
- func (b Bool) MarshalBinary() ([]byte, error)
- func (b Bool) MarshalJSON() ([]byte, error)
- func (b Bool) MarshalText() ([]byte, error)
- func (b Bool) String() string
- func (b *Bool) UnmarshalBinary(data []byte) error
- func (b *Bool) UnmarshalJSON(data []byte) error
- func (b *Bool) UnmarshalText(data []byte) error
- type Comparator
- type ComparatorKV
- type Consumer
- type ConsumerKV
- type Dict
- type Enum
- type Func
- type FuncRetry
- type FuncReturnDataOrErr
- type FuncReturnErr
- type GrpcServiceMethod
- type ID
- type Int
- type Less
- type LessKV
- type Option
- func (opt *Option[T]) Get() (T, bool)
- func (opt *Option[T]) IfNone(action func())
- func (opt *Option[T]) IfSome(action func(value T))
- func (opt *Option[T]) IsNone() bool
- func (opt *Option[T]) IsSome() bool
- func (opt *Option[T]) MarshalJSON() ([]byte, error)
- func (opt *Option[T]) UnmarshalJSON(data []byte) error
- func (opt *Option[T]) Unwrap() T
- func (opt *Option[T]) UnwrapOr(def T) T
- func (opt *Option[T]) UnwrapOrElse(fn func() T) T
- func (opt *Option[T]) Val() (T, bool)
- type OptionPtr
- func (opt OptionPtr[T]) Get() (*T, bool)
- func (opt OptionPtr[T]) IfNone(action func())
- func (opt OptionPtr[T]) IfSome(action func(value *T))
- func (opt OptionPtr[T]) IsNone() bool
- func (opt OptionPtr[T]) IsSome() bool
- func (opt OptionPtr[T]) MarshalJSON() ([]byte, error)
- func (opt *OptionPtr[T]) UnmarshalJSON(data []byte) error
- func (opt OptionPtr[T]) Unwrap() *T
- func (opt OptionPtr[T]) UnwrapOr(def *T) *T
- func (opt OptionPtr[T]) UnwrapOrElse(fn func() *T) *T
- func (opt OptionPtr[T]) Val() (*T, bool)
- type Pair
- type Predicate
- type PredicateKV
- type Ref
- type Result
- func (a Result[T]) IfErr(action func(err error))
- func (a Result[T]) IfOk(action func(value T))
- func (a Result[T]) IsErr() bool
- func (a Result[T]) IsErrAnd(f func(error) bool) bool
- func (a Result[T]) IsOk() bool
- func (a Result[T]) IsOkAnd(f func(T) bool) bool
- func (a *Result[T]) MarshalJSON() ([]byte, error)
- func (a Result[T]) Or(value T) T
- func (a Result[T]) OrDefault() (v T)
- func (a Result[T]) OrPanic() T
- func (a *Result[T]) UnmarshalJSON(data []byte) error
- func (a Result[T]) Val() (value T, err error)
- type String
- type Supplier
- type SupplierKV
- type Task
- type TaskWithErr
- type Tuple
- type UnaryFunction
- type UnaryKVFunction
- type UnaryKVFunction2
- type UnaryKVOperator
- type UnaryOperator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CastFloat ¶
func CastFloat[T, V constraints.Float](v V) T
func CastInteger ¶
func CastInteger[T, V constraints.Integer](v V) T
func CastNumber ¶
func CastNumber[T, V constraintsi.Number](v V) T
func CastSigned ¶
func CastSigned[T, V constraints.Signed](v V) T
func CastUnsigned ¶
func CastUnsigned[T, V constraints.Unsigned](v V) T
Types ¶
type BinaryFunction ¶ added in v0.3.1
type BinaryFunction[T, R, U any] func(T, R) U
BinaryFunction 将两个类型转为第三个类型
type BinaryKVFunction ¶ added in v0.3.1
type BinaryKVFunction[K, V, R, U any] func(K, V, R) U
type BinaryKVFunction2 ¶ added in v0.3.1
type BinaryKVFunction2[K, V, RK, RV, UK, UV any] func(K, V, RK, RV) (UK, UV)
type BinaryKVOperator ¶ added in v0.3.1
type BinaryKVOperator[K, V any] func(K, V, K, V) (K, V)
type BinaryOperator ¶ added in v0.3.1
type BinaryOperator[T any] func(T, T) T
BinaryOperator 输入两个相同类型的参数,对其做二元运算,返回相同类型的结果
type Bool ¶
type Bool int8
func (Bool) MarshalJSON ¶
func (*Bool) UnmarshalBinary ¶
UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (*Bool) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Bool) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type Comparator ¶ added in v0.3.1
Comparator 比较两个元素. 第一个元素大于第二个元素时,返回正数; 第一个元素小于第二个元素时,返回负数; 否则返回 0.
type ComparatorKV ¶ added in v0.3.1
Comparator 比较两个元素. 第一个元素大于第二个元素时,返回正数; 第一个元素小于第二个元素时,返回负数; 否则返回 0.
type Dict ¶
type Dict[K comparable, V any] struct { Key K Value V }
type Enum ¶
type Enum[T constraints.Unsigned | ~string] struct { Value T }
type FuncReturnDataOrErr ¶ added in v0.3.1
type FuncReturnErr ¶ added in v0.3.1
type FuncReturnErr func() error
type GrpcServiceMethod ¶ added in v0.3.1
type ID ¶
type ID[T constraintsi.ID] struct { Id T `json:"id"` }
type Option ¶
type Option[T any] struct { // contains filtered or unexported fields }
返回option 返回时会有两次复制value,后续使用还有可能更多次,自行选择用不用
func (*Option[T]) MarshalJSON ¶
func (*Option[T]) UnmarshalJSON ¶
func (*Option[T]) UnwrapOrElse ¶
func (opt *Option[T]) UnwrapOrElse(fn func() T) T
type OptionPtr ¶ added in v0.1.0
type OptionPtr[T any] struct { // contains filtered or unexported fields }
func MapOptionPtr ¶ added in v0.1.0
func (OptionPtr[T]) MarshalJSON ¶ added in v0.1.0
func (*OptionPtr[T]) UnmarshalJSON ¶ added in v0.1.0
func (OptionPtr[T]) UnwrapOrElse ¶ added in v0.1.0
func (opt OptionPtr[T]) UnwrapOrElse(fn func() *T) *T
type Result ¶
type Result[T any] struct { // contains filtered or unexported fields }
func (*Result[T]) MarshalJSON ¶
func (*Result[T]) UnmarshalJSON ¶
type TaskWithErr ¶ added in v0.3.1
type UnaryFunction ¶ added in v0.3.1
type UnaryFunction[T, R any] func(T) R
UnaryFunction 将一个类型转为另一个类型
type UnaryKVFunction ¶ added in v0.3.1
type UnaryKVFunction[K, V, R any] func(K, V) R
UnaryKVFunction 将一个类型转为另一个类型
type UnaryKVFunction2 ¶ added in v0.3.1
type UnaryKVFunction2[K, V, RK, RV any] func(K, V) (RK, RV)
type UnaryKVOperator ¶ added in v0.3.1
type UnaryKVOperator[K, V any] func(K, V) (K, V)
type UnaryOperator ¶ added in v0.3.1
type UnaryOperator[T any] func(T) T
UnaryOperator 对输入进行一元运算返回相同类型的结果
Source Files ¶
Click to show internal directories.
Click to hide internal directories.