generic

package
v0.0.0-...-e8da0a6 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AA

func AA(ss aa)

func Append

func Append[A any](dest []A, e ...A) []A

func ArrayToMap

func ArrayToMap[A comparable, B any](fn func(B) A, bb []B) map[A]B

func Bar

func Bar(t Tuple5[string, string, string, string, string])

func Fold

func Fold[A, B any](acc B, a []A, folder func(acc B, a A) B) (b B)

func Foo

func Foo(a, b, c string, d ...string)

func Foreach

func Foreach[A any](aa []A, iter func(i int, a A) bool)

func IsNil

func IsNil[A any](p *A) bool

func Left

func Left[A, B any](a A, _ B) A

func Map

func Map[A, B any](a []A, mapper func(a A) B) (b []B)

func MapE

func MapE[A, B any](a []A, mapper func(a A) (B, error)) (b []B, err error)

func MapToArray

func MapToArray[A comparable, B any](mAB map[A]B) []B

func Placeholder

func Placeholder[A any]() func(A) (A, error)

func Pointer

func Pointer[A any](a A) *A
func Right[A, B any](_ A, b B) B

func Value

func Value[A any](p *A) A

Types

type Lazy

type Lazy[A, B any] func(A) (B, error)

func Compose

func Compose[A, B, C any](lazyAB Lazy[A, B], lazyBC Lazy[B, C]) Lazy[A, C]

func Wrap

func Wrap[A, B any](fn func(A) B) Lazy[A, B]

type Pair

type Pair[A, B any] struct {
	A A
	B B
}

func (Pair[A, B]) Deconstruct

func (p Pair[A, B]) Deconstruct() (A, B)

type Tuple3

type Tuple3[A, B, C any] struct {
	A A
	B B
	C C
}

func (Tuple3[A, B, C]) Deconstruct

func (patr Tuple3[A, B, C]) Deconstruct() (A, B, C)

type Tuple4

type Tuple4[A, B, C, D any] struct {
	A A
	B B
	C C
	D D
}

func (Tuple4[A, B, C, D]) Deconstruct

func (t Tuple4[A, B, C, D]) Deconstruct() (A, B, C, D)

type Tuple5

type Tuple5[A, B, C, D, E any] struct {
	A A
	B B
	C C
	D D
	E E
}

func (Tuple5[A, B, C, D, E]) Deconstruct

func (t Tuple5[A, B, C, D, E]) Deconstruct() (A, B, C, D, E)

Jump to

Keyboard shortcuts

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