codec

package
v4.25.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReaderDocs = NewReaderDocs("codec")

ReaderDocs is a static field documentation for input codecs.

View Source
var WriterDocs = NewWriterDocs("codec")

Functions

func NewReaderDocs added in v4.25.0

func NewReaderDocs(name string) docs.FieldSpec

func NewWriterDocs added in v4.25.0

func NewWriterDocs(name string) docs.FieldSpec

Types

type Reader

type Reader interface {
	Next(context.Context) ([]*message.Part, ReaderAckFn, error)
	Close(context.Context) error
}

Reader is a codec type that reads message parts from a source.

type ReaderAckFn

type ReaderAckFn func(context.Context, error) error

ReaderAckFn is a function provided to a reader codec that it should call once the underlying io.ReadCloser is fully consumed.

type ReaderConfig

type ReaderConfig struct {
	MaxScanTokenSize int
}

ReaderConfig is a general configuration struct that covers all reader codecs.

func NewReaderConfig

func NewReaderConfig() ReaderConfig

NewReaderConfig creates a reader configuration with default values.

type ReaderConstructor

type ReaderConstructor func(string, io.ReadCloser, ReaderAckFn) (Reader, error)

ReaderConstructor creates a reader from a filename, an io.ReadCloser and an ack func which is called by the reader once the io.ReadCloser is finished with. The filename can be empty and is usually ignored, but might be necessary for certain codecs.

func GetReader

func GetReader(codec string, conf ReaderConfig) (ReaderConstructor, error)

GetReader returns a constructor that creates reader codecs.

type SuffixFn added in v4.25.0

type SuffixFn func(data []byte) ([]byte, bool)

func GetWriter

func GetWriter(codec string) (sFn SuffixFn, appendMode bool, err error)

type WriterConfig

type WriterConfig struct {
	Append bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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