Documentation
¶
Overview ¶
Package op provides generic operations that can be used for converting or reducing collections, loops, slices
Index ¶
- func Compare[O cmp.Ordered](o1, o2 O) int
- func Get[T any](getter func() T) T
- func IfElse[T any](ok bool, tru, fal T) T
- func IfElseErr[T any](ok bool, tru T, err error) (T, error)
- func IfElseErrf[T any](ok bool, tru T, format string, a ...any) (T, error)
- func IfElseGet[T any](ok bool, tru T, fal func() T) T
- func IfElseGetErr[T any](ok bool, tru T, err func() error) (T, error)
- func IfElseGetWithErr[T any](ok bool, tru T, fal func() (T, error)) (T, error)
- func IfGetElse[T any](ok bool, tru func() T, fal T) T
- func IfGetElseGet[T any](ok bool, tru, fal func() T) T
- func IfGetElseGetErr[T any](ok bool, tru func() T, fal func() error) (T, error)
- func Max[T cmp.Ordered](a T, b T) T
- func Min[T cmp.Ordered](a T, b T) T
- func Sub[T Number](a T, b T) T
- func Sum[T Summable](a T, b T) T
- type Number
- type Summable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compare ¶ added in v0.0.11
Compare returns -1 if o1 less than o2, 0 if equal and 1 if 01 more tha o2.
func Get ¶ added in v0.0.10
func Get[T any](getter func() T) T
Get calls the getter and returns the result.
func IfElseErr ¶ added in v0.0.8
IfElseErr returns the tru value if ok, otherwise returns the specified error.
func IfElseErrf ¶ added in v0.0.17
IfElseErrf returns the tru value if ok, otherwise returns an error creating by fmt.Errorf.
func IfElseGet ¶ added in v0.0.17
IfElseGet returns the tru value if ok, otherwise exec the fal function and returns it result.
func IfElseGetErr ¶ added in v0.0.17
IfElseGetErr returns the tru value if ok, otherwise returns an error returnet by the err function.
func IfElseGetWithErr ¶ added in v0.0.17
IfElseGetWithErr executes the tru func if ok, otherwise exec the fal function and returns it result.
func IfGetElse ¶ added in v0.0.8
IfGetElse executes the tru value if ok, otherwise returns the fal value.
func IfGetElseGet ¶ added in v0.0.17
IfGetElseGet executes the tru func if ok, otherwise exec the fal function and returns it result.
func IfGetElseGetErr ¶ added in v0.0.8
IfGetElseGetErr executes the tru func if ok, otherwise exec the fal function and returns its error.
Types ¶
type Number ¶ added in v0.0.17
type Number interface {
constraints.Integer | constraints.Float | constraints.Complex
}
Number is a type that supports the operators +, -, /, *.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package check provides common predicate functions
|
Package check provides common predicate functions |
|
not
Package not provides negalive predicates like 'not equals to'
|
Package not provides negalive predicates like 'not equals to' |
|
Package delay provides functions that return anonymous functions for delayed executions.
|
Package delay provides functions that return anonymous functions for delayed executions. |
|
chain
Package chain provides functions call chain builder
|
Package chain provides functions call chain builder |
|
replace
Package replace provides builders that specifies on value replacing
|
Package replace provides builders that specifies on value replacing |
|
string_
Package string_ provides string builders
|
Package string_ provides string builders |
|
string_/join
Package join provides string builders
|
Package join provides string builders |
|
string_/wrap
Package wrap provides wrap string builders
|
Package wrap provides wrap string builders |
|
sum
Package sum provides sum.Of alias
|
Package sum provides sum.Of alias |
|
Package string_ provides string utils
|
Package string_ provides string utils |
|
join
Package join provides concatenate string utils
|
Package join provides concatenate string utils |
|
wrap
Package wrap provides string wrap utils
|
Package wrap provides string wrap utils |
|
Package sum provides sum.Of alias
|
Package sum provides sum.Of alias |