Documentation ¶
Overview ¶
Package pipe implements pipes which transform data, generally for compressing it.
This package includes the pipe "zlib", which compreses any value bigger than 100 bytes using the default zlib compression level. To tell compressed and uncompressed data apart, it prepends a byte to its output (0 for uncompressed, 1 for compressed).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
Register registers a new Pipe into the pipe registry. If there's already a Pipe with the same name, it will panic.
func RequiredImport ¶
RequiredImport returns the import required for using the pipe with the given name, or the empty string if the pipe is not known.
Types ¶
type Pipe ¶
type Pipe struct { // Encode passes the given data trough the pipe and produces // a new ouput. len(data) is always > 0. Encode func(data []byte) ([]byte, error) // Decode performs the inverse operation of Encode, producing // the original input to Encode from its output. // len(data) is always > 0. Decode func(data []byte) ([]byte, error) }
Pipe represents a codec pipe, which can encode and decode data as it's saved to or loaded from the database.