Back to godoc.org

Package encoding

v0.20.5
Latest Go to latest

The latest major version is .

Published: Jul 24, 2020 | License: Apache-2.0 | Module: github.com/bufbuild/buf

Overview

Package encoding provides encoding utilities.

Index

func GetJSONStringOrStringValue

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

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

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

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.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier