support

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 5 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 added in v0.4.0

func AddrOrNil[T comparable](x T) *T

AddrOrNil returns nil if x is the zero value for T, or &x otherwise.

func CivilDateFromProto

func CivilDateFromProto(p *date.Date) civil.Date

CivilDateFromProto converts a date.Date to a civil.Date.

func CivilDateToProto

func CivilDateToProto(d civil.Date) *date.Date

CivilDateToProto converts a civil.Date to a date.Date.

func DerefOrZero added in v0.4.0

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