list

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

README

list

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound  = errors.New("entity not found")
	ErrEmptyList = errors.New("list is empty")
)

Functions

func Max added in v1.2.0

func Max[A constraints.Ordered](l List[A]) (A, error)

func MaxByField added in v1.2.0

func MaxByField[A any, B constraints.Ordered](l List[A], get func(a A) B) (A, error)

func Min added in v1.2.0

func Min[A constraints.Ordered](l List[A]) (A, error)

func MinByField added in v1.2.0

func MinByField[A any, B constraints.Ordered](l List[A], get func(a A) B) (A, error)

Types

type List

type List[A any] []A

func OrderByAsc added in v1.2.0

func OrderByAsc[A any, B constraints.Ordered](l List[A], get func(a A) B) List[A]

func OrderByDesc added in v1.2.0

func OrderByDesc[A any, B constraints.Ordered](l List[A], get func(a A) B) List[A]

func Select

func Select[A, B any](l List[A], mapper func(a A) B) List[B]

func (*List[A]) All

func (l *List[A]) All(predicate func(a A) bool) bool

func (*List[A]) Any

func (l *List[A]) Any(predicate func(a A) bool) bool

func (*List[A]) First

func (l *List[A]) First(predicate func(a A) bool) (A, error)

func (*List[A]) FirstOrDefault

func (l *List[A]) FirstOrDefault(predicate func(a A) bool) A

func (*List[A]) Where

func (l *List[A]) Where(predicate func(a A) bool) List[A]

Jump to

Keyboard shortcuts

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