op

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package op provides generic operations that can be used for converting or reducing collections, loops, slices

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IfDoElse

func IfDoElse[T any](ok bool, tru, fal func() (T, error)) (T, error)

IfDoElse exececutes the tru func if ok, otherwise exec the fal function and returns it result

func IfElse

func IfElse[T any](ok bool, tru, fal T) (T, error)

IfElse returns the tru value if ok, otherwise return the fal value

func Max

func Max[T constraints.Ordered](a T, b T) (T, error)

Max returns the maximum from two operands

func Min

func Min[T constraints.Ordered](a T, b T) (T, error)

Min returns the minimum from two operands

func Sub

func Sub[T c.Number](a T, b T) (T, error)

Sub returns the substraction of the b from the a

func Sum

func Sum[T c.Summable](a T, b T) (T, error)

Sum returns the sum of two operands

Types

This section is empty.

Jump to

Keyboard shortcuts

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