cond

package
v0.1.41 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ternary

func Ternary[T any](condition bool, ifOutput, elseOutput T) T

func TernaryF

func TernaryF[T any](condition bool, ifFunc, elseFunc func() T) T

Types

type IfElse added in v0.1.7

type IfElse[T any] struct {
	// contains filtered or unexported fields
}

func If

func If[T any](condition bool, result T) *IfElse[T]

func IfF

func IfF[T any](condition bool, resultF func() T) *IfElse[T]

func (*IfElse[T]) Else added in v0.1.7

func (i *IfElse[T]) Else(result T) T

func (*IfElse[T]) ElseF added in v0.1.7

func (i *IfElse[T]) ElseF(resultF func() T) T

func (*IfElse[T]) ElseIf added in v0.1.7

func (i *IfElse[T]) ElseIf(condition bool, result T) *IfElse[T]

func (*IfElse[T]) ElseIfF added in v0.1.7

func (i *IfElse[T]) ElseIfF(condition bool, resultF func() T) *IfElse[T]

type SwitchCase added in v0.1.7

type SwitchCase[T comparable, R any] struct {
	// contains filtered or unexported fields
}

func Switch

func Switch[T comparable, R any](predicate T) *SwitchCase[T, R]

func (*SwitchCase[T, R]) Case added in v0.1.7

func (s *SwitchCase[T, R]) Case(val T, result R) *SwitchCase[T, R]

func (*SwitchCase[T, R]) CaseF added in v0.1.7

func (s *SwitchCase[T, R]) CaseF(val T, cb func() R) *SwitchCase[T, R]

func (*SwitchCase[T, R]) Default added in v0.1.7

func (s *SwitchCase[T, R]) Default(result R) R

func (*SwitchCase[T, R]) DefaultF added in v0.1.7

func (s *SwitchCase[T, R]) DefaultF(cb func() R) R

Jump to

Keyboard shortcuts

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