Documentation ¶
Index ¶
- 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 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 Delete
- type Dict
- type DurationGenerator
- type Enum
- type Func
- type FuncWithErr
- type Get
- type GrpcServiceMethod
- type ID
- type IdGenerator
- type Init
- type Int
- type Key
- 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]) Next() *Option[T]
- 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 OptionP
- func (opt *OptionP[T]) Get() (T, bool)
- func (opt *OptionP[T]) IfNone(action func())
- func (opt *OptionP[T]) IfSome(action func(value T))
- func (opt *OptionP[T]) IsNone() bool
- func (opt *OptionP[T]) IsSome() bool
- func (opt *OptionP[T]) MarshalJSON() ([]byte, error)
- func (opt *OptionP[T]) Next() *OptionP[T]
- func (opt *OptionP[T]) UnmarshalJSON(data []byte) error
- func (opt *OptionP[T]) Unwrap() T
- func (opt *OptionP[T]) UnwrapOr(def T) T
- func (opt *OptionP[T]) UnwrapOrElse(fn func() T) T
- func (opt *OptionP[T]) Val() (T, bool)
- type Pair
- 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 Set
- type SetWithExpire
- type Store
- type StoreWithExpire
- type String
- type Task
- type TaskWithErr
- type Tuple
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CastFloat ¶ added in v1.5.0
func CastFloat[T, V constraints.Float](v V) T
func CastInteger ¶ added in v1.5.0
func CastInteger[T, V constraints.Integer](v V) T
func CastNumber ¶ added in v1.5.0
func CastNumber[T, V constraintsi.Number](v V) T
func CastSigned ¶ added in v1.5.0
func CastSigned[T, V constraints.Signed](v V) T
func CastUnsigned ¶ added in v1.5.0
func CastUnsigned[T, V constraints.Unsigned](v V) T
Types ¶
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 Delete ¶ added in v1.6.3
type Delete[K constraints.Key, V any] interface { Delete(key K) }
type Dict ¶
type Dict[K comparable, V any] struct { Key K Value V }
type DurationGenerator ¶ added in v1.6.3
type Enum ¶
type Enum[T constraints.Unsigned | ~string] struct { Value T }
type FuncWithErr ¶
type FuncWithErr func() error
type Get ¶ added in v1.6.3
type Get[K constraints.Key, V any] interface { Get(key K) V }
type GrpcServiceMethod ¶
type ID ¶
type ID[T constraintsi.ID] struct { Id T `json:"id"` }
type IdGenerator ¶ added in v1.6.3
type IdGenerator[T constraints.ID] interface { Id() T }
type Key ¶ added in v1.6.3
type Key[T constraints.Key] interface { Key() T }
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 OptionP ¶ added in v1.5.11
type OptionP[T any] struct { // contains filtered or unexported fields }
func MapOptionP ¶ added in v1.5.11
func (*OptionP[T]) MarshalJSON ¶ added in v1.5.11
func (*OptionP[T]) UnmarshalJSON ¶ added in v1.5.11
func (*OptionP[T]) UnwrapOrElse ¶ added in v1.5.11
func (opt *OptionP[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 Set ¶ added in v1.6.3
type Set[K constraints.Key, V any] interface { Set(key K, v V) }
type SetWithExpire ¶ added in v1.6.3
type SetWithExpire[K constraints.Key, V any] interface { SetWithExpire(key K, v V, expire time.Duration) }
type StoreWithExpire ¶
type StoreWithExpire[K constraints.Key, V any] interface { SetWithExpire[K, V] Get[K, V] Delete[K, V] }
type TaskWithErr ¶ added in v1.6.3
Source Files ¶
Click to show internal directories.
Click to hide internal directories.