parser

package
v0.0.0-...-7a23ab9 Latest Latest
Warning

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

Go to latest
Published: May 2, 2019 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JsonParser

type JsonParser struct {
}

func (*JsonParser) DecodeMeasurement

func (parser *JsonParser) DecodeMeasurement(input []byte) (protocol.MeasureArgument, error)

func (*JsonParser) EncodeResponse

func (parser *JsonParser) EncodeResponse(myResponse *protocol.Response) ([]byte, error)

type Parser

type Parser interface {
	DecodeMeasurement(input []byte) (protocol.MeasureArgument, error)
	EncodeResponse(myResponse *protocol.Response) ([]byte, error)
}

type TextParser

type TextParser struct {
}

func (*TextParser) DecodeMeasurement

func (parser *TextParser) DecodeMeasurement(input []byte) (protocol.MeasureArgument, error)

In this function, it firstly transform the input byte stream into a map of string -> interface{}. If it manages so, it would extract the required variable as defined in the protocol. Otherwise it would return an un-empty error.

func (*TextParser) EncodeResponse

func (parser *TextParser) EncodeResponse(myResponse *protocol.Response) ([]byte, error)

Jump to

Keyboard shortcuts

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