objconv

package
v0.0.0-...-73f2ae4 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package objconv contains code for converting formats isomorphic with JSON.

This file contains code from https://github.com/ghodss/yaml/tree/c7ce16629ff4cd059ed96ed06419dd3856fd3577 it contains convertToJSONableObject from yaml.go and all of fields.go

Copyright 2013 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChromaFormatter

func ChromaFormatter() string

ChromaFormatter is a helper to detect the ideal Chroma formatter name for colorizing output.

This function is useful for implementing Color() in the Encoding interface.

func ChromaStyle

func ChromaStyle() string

ChromaStyle is a helper to return the default Chroma style.

This function is useful for implementing Color() in the Encoding interface.

func Register

func Register(name string, format Encoding)

Register maps an encoding name to an Encoding implementation

func ToName

func ToName(format Encoding) string

ToName maps an encoder to a registered encoding name.

Types

type Decoder

type Decoder interface {
	// MarshalJSONBytes returns a JSON value per invocation. It should return
	// io.EOF when it reaches the end of it's stream input stream.
	MarshalJSONBytes() ([]byte, error)
}

Decoder is able to decode a format that is isomorphic with JSON.

type Encoder

type Encoder interface {
	UnmarshalJSONBytes(input []byte, color, pretty bool) error
}

Encoder is able to encode JSON input to a format that is isomorphic with JSON.

type Encoding

type Encoding interface {
	NewDecoder(io.Reader) Decoder
	NewEncoder(io.Writer) Encoder
}

Encoding represents any format that is isomorphic with JSON.

func ByName

func ByName(name string) (Encoding, bool)

ByName is a mapping from dynamically registered encoding names to Encoding implementations.

Jump to

Keyboard shortcuts

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