encode

package
v0.25.0-dev.2 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package encode provides encoders for input of a runner.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

type Encoder interface {
	// Encode encodes the data to the
	Encode(io.Writer, any) error
}

Encoder defines an encoder.

func Gob

func Gob() Encoder

Gob returns a new binary value encoder.

func JSON

func JSON() Encoder

JSON returns a new encoder that writes JSON.

func XML added in v0.20.10

func XML() Encoder

XML returns a new binary value encoder.

type GobEncoder added in v0.20.10

type GobEncoder struct{}

GobEncoder is a Encoder that encodes a struct into a gob.

func (GobEncoder) ContentType added in v0.20.10

func (g GobEncoder) ContentType() string

ContentType returns the content type of the encoder.

func (GobEncoder) Encode added in v0.20.10

func (g GobEncoder) Encode(w io.Writer, v any) error

Encode writes the binary encoding of v to the w stream, followed by a newline character.

type JSONEncoder added in v0.20.10

type JSONEncoder struct{}

JSONEncoder is a Encoder that encodes a struct into a json.

func (JSONEncoder) ContentType added in v0.20.10

func (j JSONEncoder) ContentType() string

ContentType returns the content type of the encoder.

func (JSONEncoder) Encode added in v0.20.10

func (j JSONEncoder) Encode(w io.Writer, v any) error

Encode writes the JSON encoding of v to the w stream, followed by a newline character.

type XMLEncoder added in v0.20.10

type XMLEncoder struct{}

XMLEncoder is a Encoder that encodes a struct into a gob.

func (XMLEncoder) ContentType added in v0.20.10

func (g XMLEncoder) ContentType() string

ContentType returns the content type of the encoder.

func (XMLEncoder) Encode added in v0.20.10

func (g XMLEncoder) Encode(w io.Writer, v any) error

Encode writes the binary encoding of v to the w stream, followed by a newline character.

Jump to

Keyboard shortcuts

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