lang

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package lang container general purpose programming helpers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bind added in v0.2.0

func Bind[T any, E any](f func(t T) E, t T) func() E

Bind converts a single-parameter function to a no-parameter one by binding the given value to the parameter. Useful together with fi.NoErrorF or defer. Bind implements the missing Partial0 from samber/lo.

func IfEmpty

func IfEmpty[T comparable](value, alt T) T

IfEmpty returns alt if value is empty (zero-value), and value itself, if not empty Simplified variant of samber/lo.CoalesceOrEmpty

func ReaderContains added in v0.3.0

func ReaderContains(reader io.Reader, substr string) bool

ReaderContains reads the given stream until it finds substr or reading fails Unlike a solution based on bufio.Scanner, it doesn't depend on newlines in the stream.

Types

This section is empty.

Jump to

Keyboard shortcuts

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