escape - ActiveState ActiveGo 1.8

Package escape

import ""

Overview ▾

Package escape contains utilities for escaping parts of InfluxQL and InfluxDB line protocol.


Codes is a map of bytes to be escaped.

var Codes = map[byte][]byte{
    ',': []byte(`\,`),
    '"': []byte(`\"`),
    ' ': []byte(`\ `),
    '=': []byte(`\=`),

func AppendUnescaped

func AppendUnescaped(dst, src []byte) []byte

AppendUnescaped appends the unescaped version of src to dst and returns the resulting slice.

func Bytes

func Bytes(in []byte) []byte

Bytes escapes characters on the input slice, as defined by Codes.

func IsEscaped

func IsEscaped(b []byte) bool

IsEscaped returns whether b has any escaped characters, i.e. whether b seems to have been processed by Bytes.

func String

func String(in string) string

String returns the escaped version of in.

func Unescape

func Unescape(in []byte) []byte

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

func UnescapeString

func UnescapeString(in string) string

UnescapeString returns unescaped version of in.