support

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package support provides support functions for protoveneer.

Index

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

func MapFromStructPB(p *structpb.Struct) map[string]any

MapFromStructPB converts a structpb.Struct to a map.

func MapToStructPB

func MapToStructPB(m map[string]any) *structpb.Struct

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.

Jump to

Keyboard shortcuts

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