lineprotocol

package
v0.0.0-...-c527c4f Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Nanosecond = iota
	Second
)

Variables

This section is empty.

Functions

func WritePoint

func WritePoint(w io.Writer, p Point) (err error)

WritePoint takes in an io.Writer and a Point and writes that point to the writer.

Types

type Field

type Field io.WriterTo

Field is an aliased io.WriterTo.

type Float

type Float struct {
	Key   []byte
	Value float64
}

Float implements the Field interface. Key is the line protocol field key as a byte slice. Value is the float key value for the field.

func (*Float) WriteTo

func (f *Float) WriteTo(w io.Writer) (int64, error)

WriteTo writes the field key value pair to an io.Writer For example if i.Key = []byte("value") and i.Value = 1 then `value=1` is written.

type Int

type Int struct {
	Value int64
	Key   []byte
}

Int implements the Field interface. Key is the line protocol field key as a byte slice. Value is the integer key value for the field.

Not that Value occurs before Key in the Int struct. The reason for this is that on both ARM and x86-32, it is the caller's responsibility to arrange for 64-bit alignment of 64-bit words accessed atomically. The first word in a global variable or in an allocated struct or slice can be relied upon to be 64-bit aligned.

func (*Int) WriteTo

func (i *Int) WriteTo(w io.Writer) (int64, error)

WriteTo writes the field key value pair to an io.Writer. For example if i.Key = []byte("value") and i.Value = 1 then `value=1i` is written.

type Point

type Point interface {
	// Byte slice representing the series key for a point.
	Series() []byte

	// Slice of Field (alais for io.WriterTo) interfaces.
	Fields() []Field

	Time() *Timestamp
	SetTime(time.Time)

	// Update is intended to be used to mutate field values.
	Update()
}

Point defines values that will be written in line protocol.

type Precision

type Precision int

Precision a type for the precision of the timestamp.

type Timestamp

type Timestamp struct {
	// contains filtered or unexported fields
}

Timestamp represents a timestamp in line protocol in either second or nanosecond precision.

func NewTimestamp

func NewTimestamp(p Precision) *Timestamp

NewTimestamp returns a pointer to a Timestamp.

func (*Timestamp) SetTime

func (t *Timestamp) SetTime(ts *time.Time)

SetTime takes an pointer to a time.Time and atomically sets the pointer on the Timestamp struct.

func (*Timestamp) TimePtr

func (t *Timestamp) TimePtr() *unsafe.Pointer

TimePtr returns an unsafe.Pointer to an underlying time.Time object.

func (*Timestamp) WriteTo

func (t *Timestamp) WriteTo(w io.Writer) (int64, error)

WriteTo writes the timestamp to an io.Writer.

Jump to

Keyboard shortcuts

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