codec

package
v0.0.0-...-482fd9e Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2019 License: GPL-3.0 Imports: 7 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
}

Codec provides Encoder/Decode functions based on user codec script

func New

func New(code []byte, id string) (*Codec, error)

New creates encoder/decoder based on given code it store user script under /tmp/codec-id.py

func NewWithoutCode

func NewWithoutCode(id string) (*Codec, error)

NewWithoutCode creates encoder/decoder without any file creation but it check user script existence under /tmp/codec-id.py

func (*Codec) Decode

func (c *Codec) Decode(ctx context.Context, r []byte) (interface{}, error)

Decode sends base64 coded data into stdin of user codec script and reads string represntation of json data object from its stdout

func (*Codec) Encode

func (c *Codec) Encode(ctx context.Context, p interface{}) ([]byte, error)

Encode sends string represntation of json data object into stdin of user codec script and reads base64 coded data from its stdout

Jump to

Keyboard shortcuts

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