Documentation
¶
Overview ¶
Package roper implements operator-style functions, largely around coalescence or variadic operations
Index ¶
- func All(a ...bool) bool
- func AllEmpty(a ...string) bool
- func AllNil(a ...interface{}) bool
- func AllZero(a ...int) bool
- func Any(a ...bool) bool
- func AnyEmpty(a ...string) bool
- func AnyNil(a ...interface{}) bool
- func AnyZero(a ...int) bool
- func Coalesce(i ...interface{}) interface{}
- func EmptyOr(a, b string) string
- func First(i ...interface{}) interface{}
- func FirstInt(s ...int) int
- func FirstStr(s ...string) string
- func IsDefaultValue(x interface{}) bool
- func NilOr(a, b interface{}) interface{}
- func ZeroOr(a, b int) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func All ¶ added in v0.4.0
All returns a bool indicating that all of the given booleans are true
func AllEmpty ¶ added in v0.3.1
AllEmpty returns a bool whether All of the variadic inputs are "empty" strings. see rstrings::IsEmpty for empty-checking logic if no inputs are passed, it defaults to true
func AllNil ¶ added in v0.3.1
func AllNil(a ...interface{}) bool
AllNil returns a bool whether All of the variadic inputs is nil if no inputs are passed, it defaults to true
func AllZero ¶ added in v0.3.1
AllZero returns a bool whether All of the variadic inputs is zero if no inputs are passed, it defaults to true
func Any ¶ added in v0.4.0
Any returns a bool indicating whether any of the given bools are true
func AnyEmpty ¶ added in v0.3.1
AnyEmpty returns a bool whether any of the variadic inputs is an "empty" string. see rstrings::IsEmpty for empty-checking logic if no inputs are passed, it defaults to false
func AnyNil ¶ added in v0.3.1
func AnyNil(a ...interface{}) bool
AnyNil returns a bool whether any of the variadic inputs is nil if no inputs are passed, it defaults to false
func AnyZero ¶ added in v0.3.1
AnyZero returns a bool whether any of the variadic inputs is zero if no inputs are passed, it defaults to false
func Coalesce ¶ added in v0.3.1
func Coalesce(i ...interface{}) interface{}
Coalesce is an alias for First
func EmptyOr ¶
EmptyOr is a coalescence operator similar to the python style "x = x or y", used to choose the first non-empty string
func First ¶ added in v0.3.1
func First(i ...interface{}) interface{}
First is a coalescing function to return the first non-type-default argument in the variadic arg list see IsDefaultValue for the default checking implementation
func FirstInt ¶ added in v0.3.1
FirstInt is an int typed wrapper for First
func FirstStr ¶ added in v0.3.1
FirstStr is a string typed wrapper for First
func IsDefaultValue ¶ added in v0.3.1
func IsDefaultValue(x interface{}) bool
IsDefaultValue returns whether the given interface is the default for its kind i.e. IsDefaultValue(1) -> false IsDefaultValue("") -> true
func NilOr ¶
func NilOr(a, b interface{}) interface{}
NilOr is a coalescence operator similar to the python style "x = x or y", used to choose the first non-nil variable
Types ¶
This section is empty.