lang

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package lang contains quality-of-life language functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deref

func Deref[T any](ref *T) T

Deref de-references the given item pointer. If null pointer, returns the zero value of the item

func Identity

func Identity[T any](item T) T

Identity returns the passed argument, used as function argument

func IsEqual

func IsEqual[T comparable](value T) func(T) bool

IsEqual returns a function that checks if value is equal to given value, used as function argument

func IsGreater

func IsGreater[T cmp.Ordered](value T) func(T) bool

IsGreater returns a function that checks if value is greater than given value, used as function argument

func IsGreaterEqual

func IsGreaterEqual[T cmp.Ordered](value T) func(T) bool

IsGreaterEqual returns a function that checks if value is greater than or equal to given value, used as function argument

func IsLesser

func IsLesser[T cmp.Ordered](value T) func(T) bool

IsLesser returns a function that checks if value is lesser than given value, used as function argument

func IsLesserEqual

func IsLesserEqual[T cmp.Ordered](value T) func(T) bool

IsLesserEqual returns a function that checks if value is lesser than or equal to given value, used as function argument

func NotEqual

func NotEqual[T comparable](value T) func(T) bool

NotEqual returns a function that checks if value is not equal to given value, used as function argument

func Ref

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

Ref returns a reference to given item

func SortAscending

func SortAscending[T cmp.Ordered]() func(T, T) int

SortAscending creates a comparison function for ascending order

func SortDescending

func SortDescending[T cmp.Ordered]() func(T, T) int

SortDescending creates a comparison function for descending order

func Ternary

func Ternary[T any](condition bool, valueTrue, valueFalse T) T

Ternary mimics the ternary operator : condition ? valueTrue : valueFalse

Types

This section is empty.

Jump to

Keyboard shortcuts

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