mapper

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package mapper transforms values and collections with explicit mapping functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Map

func Map[In any, Out any](
	in *In,
	fn func(*In) Out,
) Out

Map maps a non-nil input; nil returns the output zero value without calling fn.

func MapGroups

func MapGroups[In any, Out any](
	m map[string][]*In,
	fn Func[*In, Out],
) map[string][]Out

MapGroups maps each named group while preserving its key and item order.

func MapSlice

func MapSlice[In any, Out any](
	items []*In,
	fn Func[*In, Out],
) []Out

MapSlice preserves order and maps nil entries to output zero values.

Types

type Func

type Func[In any, Out any] func(In) Out

Func maps one input to an output.

Jump to

Keyboard shortcuts

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