mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-11-22 11:34:22 +00:00
Bumped influxdb to 0.12.2 in Godeps
This commit is contained in:
45
vendor/github.com/influxdata/influxdb/pkg/escape/bytes.go
generated
vendored
Normal file
45
vendor/github.com/influxdata/influxdb/pkg/escape/bytes.go
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
package escape
|
||||
|
||||
import "bytes"
|
||||
|
||||
func Bytes(in []byte) []byte {
|
||||
for b, esc := range Codes {
|
||||
in = bytes.Replace(in, []byte{b}, esc, -1)
|
||||
}
|
||||
return in
|
||||
}
|
||||
|
||||
func Unescape(in []byte) []byte {
|
||||
i := 0
|
||||
inLen := len(in)
|
||||
var out []byte
|
||||
|
||||
for {
|
||||
if i >= inLen {
|
||||
break
|
||||
}
|
||||
if in[i] == '\\' && i+1 < inLen {
|
||||
switch in[i+1] {
|
||||
case ',':
|
||||
out = append(out, ',')
|
||||
i += 2
|
||||
continue
|
||||
case '"':
|
||||
out = append(out, '"')
|
||||
i += 2
|
||||
continue
|
||||
case ' ':
|
||||
out = append(out, ' ')
|
||||
i += 2
|
||||
continue
|
||||
case '=':
|
||||
out = append(out, '=')
|
||||
i += 2
|
||||
continue
|
||||
}
|
||||
}
|
||||
out = append(out, in[i])
|
||||
i += 1
|
||||
}
|
||||
return out
|
||||
}
|
||||
34
vendor/github.com/influxdata/influxdb/pkg/escape/strings.go
generated
vendored
Normal file
34
vendor/github.com/influxdata/influxdb/pkg/escape/strings.go
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
package escape
|
||||
|
||||
import "strings"
|
||||
|
||||
var (
|
||||
Codes = map[byte][]byte{
|
||||
',': []byte(`\,`),
|
||||
'"': []byte(`\"`),
|
||||
' ': []byte(`\ `),
|
||||
'=': []byte(`\=`),
|
||||
}
|
||||
|
||||
codesStr = map[string]string{}
|
||||
)
|
||||
|
||||
func init() {
|
||||
for k, v := range Codes {
|
||||
codesStr[string(k)] = string(v)
|
||||
}
|
||||
}
|
||||
|
||||
func UnescapeString(in string) string {
|
||||
for b, esc := range codesStr {
|
||||
in = strings.Replace(in, esc, b, -1)
|
||||
}
|
||||
return in
|
||||
}
|
||||
|
||||
func String(in string) string {
|
||||
for b, esc := range codesStr {
|
||||
in = strings.Replace(in, b, esc, -1)
|
||||
}
|
||||
return in
|
||||
}
|
||||
Reference in New Issue
Block a user