codec

package
v4.41.0 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReaderDocs

func NewReaderDocs(name string) docs.FieldSpec

NewReaderDocs returns the field documentation for input codecs.

func NewWriterDocs

func NewWriterDocs(name string) docs.FieldSpec

NewWriterDocs returns the field documentation for writer codecs.

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

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

SuffixFn is a function which should be called by codec writers to determine when a custom suffix must be emitted by the writer codec.

func GetWriter

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

GetWriter returns a codec writer.

type WriterConfig

type WriterConfig struct {
	Append bool
}

WriterConfig is a general configuration struct that covers all writer codecs.

Jump to

Keyboard shortcuts

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