influx

package
v2.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MaxTsLen is maximum number of characters a valid timestamp can be.
	MaxTsLen = len(fmt.Sprint(maxNanoTime))

	// ErrTimeOutOfRange gets returned when time is out of the representable range using int64 nanoseconds since the epoch.
	ErrTimeOutOfRange = fmt.Errorf("time outside range %d - %d", minNanoTime, maxNanoTime)
)

Functions

func Escape

func Escape(in []byte, chars []byte) []byte

Escape returns IN with any bytes in CHARS backslash escaped.

func EscapeMeasurement

func EscapeMeasurement(in []byte) []byte

EscapeMeasurement escapes the characters that need to escaped in a measurement name.

func EscapeQuotedString

func EscapeQuotedString(in []byte) []byte

EscapeQuotedString escapes the characters that need to escaped in a quoted string. The returned value is wrapped in double quotes.

func EscapeTagPart

func EscapeTagPart(in []byte) []byte

EscapeTagPart escapes the characters that need to be escaped in a tag key or tag value.

func ExtractNanos

func ExtractNanos(line []byte) (int64, int)

ExtractNanos returns the value and offset of the timestamp in a InfluxDB line protocol line. It is optimised for - and only works for - timestamps in nanosecond precision. Use ExtractTimestamp() if timestamps in other precisions may be present. If no valid timestamp is present, an offset of -1 is returned.

func ExtractTimestamp

func ExtractTimestamp(line []byte) (int64, int)

ExtractTimestamp returns the value and offset of the timestamp in a InfluxDB line protocol line. If no valid timestamp is present, an offset of -1 is returned.

func QuotedString

func QuotedString(s []byte) ([]byte, []byte, error)

QuotedString takes a byte slice which begins with a double quoted string and returns the unescaped contents of the string and the unprocessed remainder of the input. Errors are returned if the input isn't a valid string field value.

func SafeCalcTime

func SafeCalcTime(timestamp int64, precision string) (int64, error)

SafeCalcTime safely calculates the time given. Will return error if the time is outside the supported range.

func Token

func Token(s []byte, until []byte) ([]byte, []byte)

Token takes an escaped line protocol line and returns the unescaped characters leading up to until.

func TokenEscaped

func TokenEscaped(s []byte, until []byte) ([]byte, []byte)

TokenEscaped takes an escaped line protocol line and returns the escaped characters leading up to until.

func Unescape

func Unescape(in []byte) []byte

Unescape returns a new slice containing the unescaped version of in.

This has the same semantics as Unescape() from github.com/influxdata/influxdb/pkg/escape but is faster.

Types

type Tag

type Tag struct {
	Key   []byte
	Value []byte
}

Tag represents a key/value pair (both bytes).

func NewTag

func NewTag(key, value string) Tag

NewTag creates a new Tag instance from key & value strings.

type TagSet

type TagSet []Tag

TagSet hold a number of Tag pairs. It implements sort.Interface.

func ParseTags

func ParseTags(line []byte) ([]byte, TagSet, []byte, error)

ParseTags extracts the measurement name and tagset out of a line. The measurement name, tag key and tag values are unescaped. The remainder of the line (i.e. fields and timestamp) is also returned unchanged. Errors are returned if incorrectly formatted tags are present in the line.

func (TagSet) Bytes

func (t TagSet) Bytes() []byte

Bytes returns the TagSet in line protocol format. Tag keys and values are escaped if necessary.

func (TagSet) Len

func (t TagSet) Len() int

func (TagSet) Less

func (t TagSet) Less(i, j int) bool

func (TagSet) SubsetOf

func (t TagSet) SubsetOf(other TagSet) bool

SubsetOf returns true if T is a subset of OTHER.

func (TagSet) Swap

func (t TagSet) Swap(i, j int)

Jump to

Keyboard shortcuts

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