utils

package
v0.0.0-...-f59b33f Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

func Diff[T cmp.Ordered](a []T, b []T) []T

Diff return the elements in a that are not in b

func Max

func Max[T cmp.Ordered](values ...T) T

Max returns the max value in given values

func Min

func Min[T cmp.Ordered](values ...T) T

Min returns the min value in given values

func Must

func Must[T any](v1 T, err error) T

Must return the value, but panics when err is not nil

func Must2

func Must2[T1, T2 any](v1 T1, v2 T2, err error) (T1, T2)

Must2 return the values, but panics when err is not nil

func Must3

func Must3[T1, T2, T3 any](v1 T1, v2 T2, v3 T3, err error) (T1, T2, T3)

Must3 return the values, but panics when err is not nil

func Must4

func Must4[T1, T2, T3, T4 any](v1 T1, v2 T2, v3 T3, v4 T4, err error) (T1, T2, T3, T4)

Must4 return the values, but panics when err is not nil

func Ptr

func Ptr[T any](value T) *T

Ptr returns the pointer to the specific value

func Through

func Through[T any](value T, callbacks ...func(value T)) T

Through call the given callbacks with the given value then return the value.

func With

func With[T any](value T, callbacks ...func(value T) T) T

With returns the given value, passed through the given callbacks.

Types

This section is empty.

Jump to

Keyboard shortcuts

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