codec

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Codec

type Codec struct {
	// contains filtered or unexported fields
}

func New

func New(format Format) *Codec

func (*Codec) Read

func (c *Codec) Read(reader Reader, object interface{}) (time.Time, error)

func (*Codec) Write

func (c *Codec) Write(writer Writer, object interface{}) (time.Time, error)

func (*Codec) WriteWithTime

func (c *Codec) WriteWithTime(writer WriterWithTime, t time.Time, object interface{}) error

type Format

type Format interface {
	// Encode can (optionally) append bytes to the passed output slice to reduce allocations.
	Encode(input interface{}, output []byte) (out []byte, err error)
	Decode(input []byte, output interface{}) error
}

func JSON

func JSON() Format

type Reader

type Reader interface {
	Read() (time.Time, []byte, error)
}

type Writer

type Writer interface {
	Write(entry []byte) (time.Time, error)
}

type WriterWithTime

type WriterWithTime interface {
	WriteWithTime(t time.Time, entry []byte) error
}

Jump to

Keyboard shortcuts

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