utilencoding

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package utilencoding provides encoding utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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.

Types

This section is empty.

Jump to

Keyboard shortcuts

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