tool

package
v17.7.0-rc31 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapToSlice added in v17.5.2

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 SliceToMap added in v17.5.2

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 added in v17.5.2

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 added in v17.5.2

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 added in v17.5.2

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

func (*Accumulator[E, V]) Grow added in v17.5.2

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

Directories

Path Synopsis
testing
mock_agent_registrar
Package mock_agent_registrar is a generated GoMock package.
Package mock_agent_registrar 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_agentk2kas_router
Package mock_agentk2kas_router is a generated GoMock package.
Package mock_agentk2kas_router is a generated GoMock package.
mock_cache
Package mock_cache is a generated GoMock package.
Package mock_cache 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_gitaly
Mocks for Gitaly.
Mocks for Gitaly.
mock_gitlab_access
Mocks for GitLab access RPC.
Mocks for GitLab access RPC.
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 contains Go standard library mocks
Package mock_stdlib contains Go standard library mocks
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.

Jump to

Keyboard shortcuts

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