buf: github.com/bufbuild/buf/internal/pkg/encodingutil Index | Files

package encodingutil

import "github.com/bufbuild/buf/internal/pkg/encodingutil"

Package encodingutil provides encoding utilities.

Index

Package Files

encodingutil.go

func GetJSONStringOrStringValue Uses

func GetJSONStringOrStringValue(rawMessage json.RawMessage) string

GetJSONStringOrStringValue returns the JSON string for the RawMessage if the RawMessage is a string, and the raw value as a string otherwise.

If the RawMessage is empty, this returns "".

func UnmarshalJSONOrYAMLStrict Uses

func UnmarshalJSONOrYAMLStrict(data []byte, v interface{}) error

UnmarshalJSONOrYAMLStrict unmarshals the data as JSON or YAML in order, returning a user error with both errors on failure.

If the data length is 0, this is a no-op.

func UnmarshalJSONStrict Uses

func UnmarshalJSONStrict(data []byte, v interface{}) error

UnmarshalJSONStrict unmarshals the data as JSON, returning a user error on failure.

If the data length is 0, this is a no-op.

func UnmarshalYAMLStrict Uses

func UnmarshalYAMLStrict(data []byte, v interface{}) error

UnmarshalYAMLStrict unmarshals the data as YAML, returning a user error on failure.

If the data length is 0, this is a no-op.

Package encodingutil imports 5 packages (graph). Updated 2019-12-07. Refresh now. Tools for package owners.