get

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 1 Imported by: 3

Documentation

Overview

Package get provides conditional expression builders

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func If

func If[T any](condition bool, then func() T) use.When[T]

If builds a head of getter function call by condition. Looks like val := get.If(condition, getterFuncOnTrue).Else(defaltVal) tha can be rewrited by:

var val type
if condtion {
	val = getterFuncOnTrue()
} else {
	val = defaltVal
}

func IfErr

func IfErr[T any](condition bool, then func() (T, error)) use.WhenErr[T]

IfErr is like If but aimed to use an error return function

func If_

func If_[T any](condition bool, tru func() (T, error)) use.WhenErr[T]

If_ is alias of IfErr

Types

This section is empty.

Jump to

Keyboard shortcuts

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