Documentation ¶
Index ¶
- Variables
- func Escape(in []byte, chars []byte) []byte
- func EscapeMeasurement(in []byte) []byte
- func EscapeQuotedString(in []byte) []byte
- func EscapeTagPart(in []byte) []byte
- func ExtractNanos(line []byte) (int64, int)
- func ExtractTimestamp(line []byte) (int64, int)
- func QuotedString(s []byte) ([]byte, []byte, error)
- func SafeCalcTime(timestamp int64, precision string) (int64, error)
- func Token(s []byte, until []byte) ([]byte, []byte)
- func TokenEscaped(s []byte, until []byte) ([]byte, []byte)
- func Unescape(in []byte) []byte
- type Tag
- type TagSet
Constants ¶
This section is empty.
Variables ¶
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 EscapeMeasurement ¶
EscapeMeasurement escapes the characters that need to escaped in a measurement name.
func EscapeQuotedString ¶
EscapeQuotedString escapes the characters that need to escaped in a quoted string. The returned value is wrapped in double quotes.
func EscapeTagPart ¶
EscapeTagPart escapes the characters that need to be escaped in a tag key or tag value.
func ExtractNanos ¶
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 ¶
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 ¶
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 ¶
SafeCalcTime safely calculates the time given. Will return error if the time is outside the supported range.
func Token ¶
Token takes an escaped line protocol line and returns the unescaped characters leading up to until.
func TokenEscaped ¶
TokenEscaped takes an escaped line protocol line and returns the escaped characters leading up to until.
Types ¶
type TagSet ¶
type TagSet []Tag
TagSet hold a number of Tag pairs. It implements sort.Interface.
func ParseTags ¶
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 ¶
Bytes returns the TagSet in line protocol format. Tag keys and values are escaped if necessary.