patchstructpb

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertFromValue

func ConvertFromValue(to, from any, opts ...Option) (any, error)

ConvertFromValue attempts to convert structpb.Value (or a value that is part of structpb.Value, like structpb.NullValue, structpb.Struct, structpb.ListValue, float64, string or bool) to appropriate proto type.

func ConvertListToValue

func ConvertListToValue(li protopatch.List, opts ...Option) (*structpb.Value, error)

func ConvertMapToValue

func ConvertMapToValue(ma protopatch.Map, opts ...Option) (*structpb.Value, error)

func ConvertMessageToValue

func ConvertMessageToValue(m proto.Message, opts ...Option) (*structpb.Value, error)

func ConvertToValue

func ConvertToValue(to, from any, opts ...Option) (any, error)

ConvertToValue attempts to convert the given proto type value into structpb.Value (or a value that is part of structpb.Value, like structpb.NullValue, structpb.Struct, structpb.ListValue, float64, string or bool).

func FromValueConverter

func FromValueConverter(opts ...Option) protopatch.Converter

FromValueConverter returns a converter that attempts to convert structpb.Value (or a value that is part of structpb.Value, like structpb.NullValue, structpb.Struct, structpb.ListValue, float64, string or bool) to appropriate proto type.

func ToValueConverter

func ToValueConverter(opts ...Option) protopatch.Converter

ToValueConverter returns a converter that attempts to convert the given proto type value into structpb.Value (or a value that is part of structpb.Value, like structpb.NullValue, structpb.Struct, structpb.ListValue, float64, string or bool).

func ValueContainerTransform

func ValueContainerTransform(container protopatch.Container, opts ...Option) (protopatch.Container, error)

func ValueContainerTransformer

func ValueContainerTransformer(opts ...Option) protopatch.ContainerTransformer

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

func ClearInvalidValues

func ClearInvalidValues() Option

ClearInvalidValues returns option that clears from the source structure each inner value which type do not matches.

func ClearUnknownKeys

func ClearUnknownKeys() Option

ClearUnknownKeys returns option that clears from the source structure each inner unknown key when converting from structpb.Struct to proto.Message or when parsing a map key fails.

func IgnoreInvalidValues

func IgnoreInvalidValues() Option

IgnoreInvalidValues returns option that ignores each inner source value which type do not matches.

func IgnoreUnknownKeys

func IgnoreUnknownKeys() Option

IgnoreUnknownKeys returns option that ignores unknown keys when converting from structpb.Struct to proto.Message or when parsing a map key fails.

Jump to

Keyboard shortcuts

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