encoder

package
v0.0.0-...-80c8c53 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDelimiter = ','

DefaultDelimiter defines default delimiter expected in encoded data.

Functions

This section is empty.

Types

type CPLEX

type CPLEX struct{}

CPLEX facilitates encoding Data to CPLEX data format.

func (CPLEX) Decode

func (e CPLEX) Decode(reader io.Reader) (*data.Data, error)

Decode allows for decoding CPLEX data format to Data. It returns an error if the sizes of R and MRB are not equal to size variables [V, N]. It is possible to decode data with additional variables defined. In such a case Decode skips these values.

func (CPLEX) Encode

func (e CPLEX) Encode(input *data.Data, writer io.Writer) error

Encode allows for encoding Data to CPLEX data format.

type JSON

type JSON struct{}

JSON provide methods for encoding and decoding Data structure into/from json.

func (JSON) Decode

func (e JSON) Decode(r io.Reader) (*data.Data, error)

Decode allows for conveniently decoding data from json format to Data structure.

func (JSON) Encode

func (e JSON) Encode(input *data.Data, w io.Writer) error

Encode facilitates encoding Data to json.

type Plain

type Plain struct{}

Plain facilitates encoding/decoding Data into CSV-like format. For example: 1,2,3,4,5 6,7,8,9,2 9,4,2,1,0 where the first line is MRB values and further lines are R values.

func (Plain) Decode

func (e Plain) Decode(reader io.Reader) (*data.Data, error)

Decode allows for decoding data from reader in CSV-like format. It returns an error if the lengths of R slices are not equal to MRB slice length. It is possible to decode data that consists only of MRB values. Input data line should be ended with newline '\n' character, however, it is possible to do not use '\n' in the last line.

func (Plain) Encode

func (e Plain) Encode(input *data.Data, writer io.Writer) error

Encode allows for encoding data to writer into CSV-like format. It returns ErrMalformedData if the lengths of R slices are not equal to MRB slice length. It is possible to encode Data that consists only of MRB values.

Jump to

Keyboard shortcuts

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