writer

package
v0.0.17 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("writer: not implemented")

ErrNotImplemented is the error returned if a method is not implemented.

Functions

func Register

func Register(format Format, factory Factory)

Register registers a writer factory by format.

The writer MUST have a named format: lower case and one word.

Types

type Factory

type Factory func(w io.Writer) (Writer, error)

Factory is a function that returns a writer interface. An error is returned if the writer fails to initialize, nil otherwise.

func GetFactory

func GetFactory(format Format) (Factory, error)

GetFactory returns a factory of writer by format.

type Format

type Format string

Format represents the format of a writer.

type Writer

type Writer interface {
	Write(obj interface{}) error
}

Writer defines the interface that should be implemented by a writer.

func GetInstance

func GetInstance(format Format, w io.Writer) (Writer, error)

GetInstance returns an instance of writer by format.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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