Documentation
¶
Index ¶
- func Compare[T cmp.Ordered](l, r *T) int
- func CompareBy[T any](l, r *T, cmp func(T, T) int) int
- func Equal[T comparable](l, r *T) bool
- func EqualBy[T any](l, r *T, eq func(T, T) bool) bool
- func OrZero[T any](v *T) *T
- func Ref[T any](t T) *T
- func RefOrNil[T comparable](t T) *T
- func ValueOr[T any](v *T, d T) T
- func ValueOrZero[T any](v *T) T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compare ¶ added in v0.4.0
Compare compares two pointer. If both non-nil, compare underlying data, if both nil, return 0, non-nil pointer is always greater than nil pointer.
func Equal ¶ added in v0.4.0
func Equal[T comparable](l, r *T) bool
Equal test whether two pointer are equal. If both non-nil, test underlying data, if both nil, return true, else return false
func RefOrNil ¶ added in v0.4.0
func RefOrNil[T comparable](t T) *T
RefOrNil return reference of value if it not the zero value, else return nil
func ValueOr ¶ added in v0.4.0
func ValueOr[T any](v *T, d T) T
ValueOr return value of pointer if not nil, else return default value.
func ValueOrZero ¶ added in v0.4.0
func ValueOrZero[T any](v *T) T
ValueOrZero return value of pointer if not nil, else return zero value.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.