tool

package
v19.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapKeys

func MapKeys[M ~map[K]V, K comparable, V any](m M) []K

func MapToSlice

func MapToSlice[K comparable, E, V1, V2 any, IN ~map[K]V1, OUT ~[]V2](
	in IN,
	v1Len func(V1) int,
	appendV1ToSlice func(V1, []E) []E,
	elemToV2 func(K, []E) V2,
) OUT

func MapValues

func MapValues[M ~map[K]V, K comparable, V any](m M) []V

func SliceToMap

func SliceToMap[K comparable, E, V1, V2 any, IN ~[]V1, OUT ~map[K]V2](
	in IN,
	v1Len func(V1) int,
	appendV1ToSlice func(V1, []E) []E,
	elemToV2 func(V1, []E) (K, V2),
) OUT

func StringMapToSliceWithBytes

func StringMapToSliceWithBytes[V2 any, IN ~map[string][]string, OUT ~[]V2](
	from IN,
	elemToV2 func(string, [][]byte) V2,
) OUT

func TransformMap

func TransformMap[K comparable, E, V1, V2 any, IN ~map[K]V1, OUT ~map[K]V2](
	in IN,
	v1Len func(V1) int,
	appendV1ToSlice func(V1, []E) []E,
	elemToV2 func([]E) V2,
) OUT

TransformMap transforms map of type IN into a map of type OUT. The main point of this function is to optimize memory usage. It allocates a single slice for the elements in values of the map rather than a slice per key.

Types

type Accumulator

type Accumulator[E, V any] struct {
	Append func(V, []E) []E
	// contains filtered or unexported fields
}

Accumulator allows to reduce the number of allocations by packing multiple slices into a single big slice.

func (*Accumulator[E, V]) Clone

func (a *Accumulator[E, V]) Clone(v V) []E

func (*Accumulator[E, V]) Grow

func (a *Accumulator[E, V]) Grow(size int)

Directories

Path Synopsis
testing
mock_agent2kas_router
Package mock_agent2kas_router is a generated GoMock package.
Package mock_agent2kas_router is a generated GoMock package.
mock_agent_tracker
Package mock_agent_tracker is a generated GoMock package.
Package mock_agent_tracker is a generated GoMock package.
mock_autocore
Package mock_autocore is a generated GoMock package.
Package mock_autocore is a generated GoMock package.
mock_autoflow
Package mock_autoflow is a generated GoMock package.
Package mock_autoflow is a generated GoMock package.
mock_cache
Package mock_cache is a generated GoMock package.
Package mock_cache is a generated GoMock package.
mock_cmd_agent
Package mock_cmd_agent is a generated GoMock package.
Package mock_cmd_agent is a generated GoMock package.
mock_event_tracker
Package mock_event_tracker is a generated GoMock package.
Package mock_event_tracker is a generated GoMock package.
mock_flowcore
Package mock_flowcore is a generated GoMock package.
Package mock_flowcore is a generated GoMock package.
mock_gitaly
Package mock_gitaly is a generated GoMock package.
Package mock_gitaly is a generated GoMock package.
mock_gitlab_access
Package mock_gitlab_access is a generated GoMock package.
Package mock_gitlab_access is a generated GoMock package.
mock_internalgitaly
Package mock_internalgitaly is a generated GoMock package.
Package mock_internalgitaly is a generated GoMock package.
mock_k8s
Package mock_k8s is a generated GoMock package.
Package mock_k8s is a generated GoMock package.
mock_kubernetes_api
Package mock_kubernetes_api is a generated GoMock package.
Package mock_kubernetes_api is a generated GoMock package.
mock_modagent
Package mock_modagent is a generated GoMock package.
Package mock_modagent is a generated GoMock package.
mock_modserver
Package mock_modserver is a generated GoMock package.
Package mock_modserver is a generated GoMock package.
mock_modshared
Package mock_modshared is a generated GoMock package.
Package mock_modshared is a generated GoMock package.
mock_otel
Package mock_otel is a generated GoMock package.
Package mock_otel is a generated GoMock package.
mock_redis
Package mock_redis is a generated GoMock package.
Package mock_redis is a generated GoMock package.
mock_rpc
Package mock_rpc is a generated GoMock package.
Package mock_rpc is a generated GoMock package.
mock_stdlib
Package mock_stdlib is a generated GoMock package.
Package mock_stdlib is a generated GoMock package.
mock_tool
Package mock_tool is a generated GoMock package.
Package mock_tool is a generated GoMock package.
mock_tunnel_rpc
Package mock_tunnel_rpc is a generated GoMock package.
Package mock_tunnel_rpc is a generated GoMock package.
mock_tunnel_tunserver
Package mock_tunnel_tunserver is a generated GoMock package.
Package mock_tunnel_tunserver is a generated GoMock package.
mock_usage_metrics
Package mock_usage_metrics is a generated GoMock package.
Package mock_usage_metrics is a generated GoMock package.
testautocore/helper
Package helper (imported as testautocore_helper) provides low-level SQL assertions and mutations used by autocore tests.
Package helper (imported as testautocore_helper) provides low-level SQL assertions and mutations used by autocore tests.
testotel
Package testotel provides helpers for asserting on OpenTelemetry metrics in tests.
Package testotel provides helpers for asserting on OpenTelemetry metrics in tests.

Jump to

Keyboard shortcuts

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