Documentation ¶
Overview ¶
Package support provides support functions for protoveneer.
Index ¶
- func AddrOrNil[T comparable](x T) *T
- func DerefOrZero[T any](x *T) T
- func MapFromStructPB(p *structpb.Struct) map[string]any
- func MapToStructPB(m map[string]any) *structpb.Struct
- func TransformMapValues[K comparable, VFrom, VTo any](from map[K]VFrom, f func(VFrom) VTo) map[K]VTo
- func TransformSlice[From, To any](from []From, f func(From) To) []To
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddrOrNil ¶
func AddrOrNil[T comparable](x T) *T
AddrOrNil returns nil if x is the zero value for T, or &x otherwise.
func DerefOrZero ¶
func DerefOrZero[T any](x *T) T
DerefOrZero returns the zero value for T if x is nil, or *x otherwise.
func MapFromStructPB ¶
MapFromStructPB converts a structpb.Struct to a map.
func MapToStructPB ¶
MapToStructPB converts a map into a structpb.Struct.
func TransformMapValues ¶
func TransformMapValues[K comparable, VFrom, VTo any](from map[K]VFrom, f func(VFrom) VTo) map[K]VTo
TransformMapValues applies f to each value of from, returning a new map. It does not change the keys.
func TransformSlice ¶
func TransformSlice[From, To any](from []From, f func(From) To) []To
TransformSlice applies f to each element of from and returns a new slice with the results.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.