roper

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2023 License: BSD-3-Clause Imports: 2 Imported by: 1

Documentation

Overview

Package roper implements operator-style functions, largely around coalescence or variadic operations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All added in v0.4.0

func All(a ...bool) bool

All returns a bool indicating that all of the given booleans are true

func AllEmpty added in v0.3.1

func AllEmpty(a ...string) bool

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

func AllZero(a ...int) bool

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

func Any(a ...bool) bool

Any returns a bool indicating whether any of the given bools are true

func AnyEmpty added in v0.3.1

func AnyEmpty(a ...string) bool

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

func AnyZero(a ...int) bool

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

func EmptyOr(a, b string) string

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

func FirstInt(s ...int) int

FirstInt is an int typed wrapper for First

func FirstStr added in v0.3.1

func FirstStr(s ...string) string

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

func ZeroOr

func ZeroOr(a, b int) int

ZeroOr is a coalescence operator similar to the python style "x = x or y", used to choose the first nonzero integer

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL