package proto

import "github.com/moby/buildkit/util/gogo/proto"

Package proto is a transition package for methods from gogo that are used within buildkit and don't have an existing method in the standard protobuf library.

Index

Functions

func MarshalJSONEnum

func MarshalJSONEnum(m map[int32]string, value int32) ([]byte, error)

func UnmarshalJSONEnum

func UnmarshalJSONEnum(m map[string]int32, data []byte, enumName string) (int32, error)

UnmarshalJSONEnum is a helper function to simplify recovering enum int values from their JSON-encoded representation. Given a map from the enum's symbolic names to its int values, and a byte buffer containing the JSON-encoded value, it returns an int32 that can be cast to the enum type by the caller.

The function can deal with both JSON representations, numeric and symbolic.

Source Files

enum.go

Version
v0.21.0 (latest)
Published
Apr 11, 2025
Platform
linux/amd64
Imports
3 packages
Last checked
2 days ago

Tools for package owners.