protoutil

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsBytes

func AsBytes(src *structpb.Struct) []byte

AsBytes takes a protobuf Struct and converts it into a byte array

func AsJSONString

func AsJSONString(src *structpb.Struct) string

AsJSONString takes a protobuf Struct and converts it into a JSON string

func AsListValue

func AsListValue(str []string) *structpb.ListValue

AsListValue takes a go []string and converts it into a protobuf ListValue

func AsMap

func AsMap(src *structpb.Struct) map[string]interface{}

AsMap takes a protobuf Struct and converts it into a go map

func AsStringList

func AsStringList(src *structpb.ListValue) []string

AsStringList takes a protobuf ListValue and converts it into a []string

func AsStruct

func AsStruct(src map[string]interface{}) *structpb.Struct

AsStruct takes a go map and converts it into a protobuf Struct

func CopyStructToStruct

func CopyStructToStruct(dst *structpb.Struct, src *structpb.Struct)

CopyStructToStruct copy the contents of one protobuf struct to another

func CopyStructToStructSub

func CopyStructToStructSub(dst *structpb.Struct, keys []string, src *structpb.Struct)

CopyStructToStructSub copy the contents of one protobuf struct to another, but only using a subset of the keys

func CopyToStruct

func CopyToStruct(s *structpb.Struct, values map[string]interface{})

CopyToStruct copies values from map into protobuf struct

func CopyToStructSub

func CopyToStructSub(s *structpb.Struct, keys []string, values map[string]interface{})

CopyToStructSub copies a subset of keys from a map to a protobuf struct

func NewStruct

func NewStruct() *structpb.Struct

func StructSet

func StructSet(s *structpb.Struct, key string, value interface{})

StructSet take value and add it to Struct s using key

func UnWrapValue

func UnWrapValue(value *structpb.Value) interface{}

UnWrapValue takes protobuf structpb Value and return a native go value

func WrapValue

func WrapValue(value interface{}) *structpb.Value

WrapValue takes a value and turns it into a protobuf structpb Value

Types

This section is empty.

Jump to

Keyboard shortcuts

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