serialize

package
v0.0.0-...-e01a1e4 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestFloat             = float64(38.24311829)
	TestInt               = 38
	TestInt64             = int64(5000000000)
	ErrWriterAlwaysErr    = "bad write: I always error"
	ErrWriterSometimesErr = "bad write: I sometimes error"
)

Variables

View Source
var (
	TestNow         = time.Unix(1451606400, 0)
	TestMeasurement = []byte("cpu")
	TestTagKeys     = [][]byte{[]byte("hostname"), []byte("region"), []byte("datacenter")}
	TestTagVals     = []interface{}{"host_0", "eu-west-1", "eu-west-1b"}
	TestColFloat    = []byte("usage_guest_nice")
	TestColInt      = []byte("usage_guest")
	TestColInt64    = []byte("big_usage_guest")
)

Functions

func FastFormatAppend

func FastFormatAppend(v interface{}, buf []byte) []byte

Utility function for appending various data types to a byte string

func SerializerTest

func SerializerTest(t *testing.T, cases []SerializeCase, ps PointSerializer)

func TestPointDefault

func TestPointDefault() *data.Point

func TestPointInt

func TestPointInt() *data.Point

func TestPointMultiField

func TestPointMultiField() *data.Point

func TestPointNoTags

func TestPointNoTags() *data.Point

func TestPointWithNilField

func TestPointWithNilField() *data.Point

func TestPointWithNilTag

func TestPointWithNilTag() *data.Point

Types

type ErrWriter

type ErrWriter struct {
	SkipOne bool
	Cnt     int
}

func (*ErrWriter) Write

func (w *ErrWriter) Write(p []byte) (n int, err error)

type PointSerializer

type PointSerializer interface {
	Serialize(p *data.Point, w io.Writer) error
}

PointSerializer serializes a Point for writing

type SerializeCase

type SerializeCase struct {
	Desc       string
	InputPoint *data.Point
	Output     string
}

Jump to

Keyboard shortcuts

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