Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LazyTernaryThen ¶
type LazyTernaryThen[T any] struct { // contains filtered or unexported fields }
LazyTernaryThen represents the true value of a ternary expression with lazy evaluation.
func (*LazyTernaryThen[T]) LElse ¶
func (t *LazyTernaryThen[T]) LElse(falseVal func() T) T
LElse specifies the false value of a ternary expression with lazy evaluation and completes it.
Example: If[int](5 > 3).LThen(func() int { return 10 }).LElse(func() int { return 20 }) // returns 10
type TernaryIf ¶
type TernaryIf[T any] struct { // contains filtered or unexported fields }
TernaryIf represents the conditional part of a ternary expression.
func If ¶
If begins a ternary expression by evaluating a condition.
Example: If[int](5 > 3).Then(10).Else(20) // returns 10
func (*TernaryIf[T]) LThen ¶
func (i *TernaryIf[T]) LThen(trueVal func() T) *LazyTernaryThen[T]
LThen specifies the true value of a ternary expression with lazy evaluation.
func (*TernaryIf[T]) Then ¶
func (i *TernaryIf[T]) Then(trueVal T) *TernaryThen[T]
Then specifies the true value of a ternary expression.
type TernaryThen ¶
type TernaryThen[T any] struct { // contains filtered or unexported fields }
TernaryThen represents the true value of a ternary expression.
func (*TernaryThen[T]) Else ¶
func (t *TernaryThen[T]) Else(falseVal T) T
Else specifies the false value of a ternary expression and completes it.
Example: If[int](5 < 3).Then(10).Else(20) // returns 20