common

package
v0.0.0-...-5359b21 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JSONPBUnmarshaler = jsonpb.Unmarshaler{AllowUnknownFields: true}

JSONPBUnmarshaler unmarshals JSON into proto messages.

Functions

func MapToStruct

func MapToStruct(m map[string]interface{}) (*structpb.Struct, error)

MapToStruct constructs a Struct from the given map[string]interface{}. The map keys must be valid UTF-8. The map values can be any of Go's basic types (bool, string, number type, byte, or rune), a proto message (in the form protoreflect.ProtoMessage), or a nested map[string]interface{} that fulfils the same requirements recursively.

NOTE: This function is just a modified version of structpb.NewStruct(), with added logic to handle the case where the map value is a proto message. This is necessary because Buildbucket request interfaces are almost always implemented as proto messages at some level.

func ToKeyvalSlice

func ToKeyvalSlice(keyvals map[string]string) []string

ToKeyvalSlice converts a key-val map to a slice of "key:val" strings.

Types

This section is empty.

Jump to

Keyboard shortcuts

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