encode

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package encode provides a flexible way to encode and decode Go objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

type Encoder interface {
	//Encode takes a Go object and converts it into bytes
	Encode(input interface{}) ([]byte, error)
	// Decode takes an input of bytes and decodes it into Go object.
	Decode(input []byte, output interface{}) error
}

Encoder interface allows to switch between different encoding types.

type GNgob

type GNgob struct{}

func (GNgob) Decode

func (e GNgob) Decode(input []byte, output interface{}) error

func (GNgob) Encode

func (e GNgob) Encode(input interface{}) ([]byte, error)

type GNjson

type GNjson struct {
	Pretty bool
}

func (GNjson) Decode

func (e GNjson) Decode(input []byte, output interface{}) error

func (GNjson) Encode

func (e GNjson) Encode(input interface{}) ([]byte, error)

func (GNjson) Output

func (e GNjson) Output(input interface{}, f format.Format) string

Jump to

Keyboard shortcuts

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