Update godoc for pkg
parent
53d373b39e
commit
0551d87ddb
|
@ -28,6 +28,7 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// Package deep provides a deep equality check for use in tests.
|
||||
package deep // import "github.com/influxdata/influxdb/pkg/deep"
|
||||
|
||||
import (
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// Package escape contains utilities for escaping parts of InfluxQL
|
||||
// and InfluxDB line protocol.
|
||||
package escape // import "github.com/influxdata/influxdb/pkg/escape"
|
||||
|
||||
import (
|
||||
|
@ -5,6 +7,7 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
// Codes is a map of bytes to be escaped.
|
||||
var Codes = map[byte][]byte{
|
||||
',': []byte(`\,`),
|
||||
'"': []byte(`\"`),
|
||||
|
@ -12,6 +15,7 @@ var Codes = map[byte][]byte{
|
|||
'=': []byte(`\=`),
|
||||
}
|
||||
|
||||
// Bytes escapes characters on the input slice, as defined by Codes.
|
||||
func Bytes(in []byte) []byte {
|
||||
for b, esc := range Codes {
|
||||
in = bytes.Replace(in, []byte{b}, esc, -1)
|
||||
|
@ -21,6 +25,8 @@ func Bytes(in []byte) []byte {
|
|||
|
||||
const escapeChars = `," =`
|
||||
|
||||
// IsEscaped returns whether b has any escaped characters,
|
||||
// i.e. whether b seems to have been processed by Bytes.
|
||||
func IsEscaped(b []byte) bool {
|
||||
for len(b) > 0 {
|
||||
i := bytes.IndexByte(b, '\\')
|
||||
|
@ -36,6 +42,8 @@ func IsEscaped(b []byte) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// AppendUnescaped appends the unescaped version of src to dst
|
||||
// and returns the resulting slice.
|
||||
func AppendUnescaped(dst, src []byte) []byte {
|
||||
var pos int
|
||||
for len(src) > 0 {
|
||||
|
@ -58,6 +66,7 @@ func AppendUnescaped(dst, src []byte) []byte {
|
|||
return dst
|
||||
}
|
||||
|
||||
// Unescape returns a new slice containing the unescaped version of in.
|
||||
func Unescape(in []byte) []byte {
|
||||
if len(in) == 0 {
|
||||
return nil
|
||||
|
|
|
@ -7,6 +7,7 @@ var (
|
|||
unescaper = strings.NewReplacer(`\,`, `,`, `\"`, `"`, `\ `, ` `, `\=`, `=`)
|
||||
)
|
||||
|
||||
// UnescapeString returns unescaped version of in.
|
||||
func UnescapeString(in string) string {
|
||||
if strings.IndexByte(in, '\\') == -1 {
|
||||
return in
|
||||
|
@ -14,6 +15,7 @@ func UnescapeString(in string) string {
|
|||
return unescaper.Replace(in)
|
||||
}
|
||||
|
||||
// String returns the escaped version of in.
|
||||
func String(in string) string {
|
||||
return escaper.Replace(in)
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
// Package limiter provides concurrency limiters.
|
||||
package limiter
|
||||
|
||||
// Fixed is a simple channel based concurrency limiter. It uses a fixed
|
||||
// size channel to limit callers from proceeding until there is a value avalable
|
||||
// Fixed is a simple channel-based concurrency limiter. It uses a fixed
|
||||
// size channel to limit callers from proceeding until there is a value available
|
||||
// in the channel. If all are in-use, the caller blocks until one is freed.
|
||||
type Fixed chan struct{}
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// Package pool provides pool structures to help reduce garbage collector pressure.
|
||||
package pool
|
||||
|
||||
// Bytes is a pool of byte slices that can be re-used. Slices in
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
// Package slices contains functions to operate on slices treated as sets.
|
||||
package slices // import "github.com/influxdata/influxdb/pkg/slices"
|
||||
|
||||
import "strings"
|
||||
|
||||
// Union combines two string sets
|
||||
// Union combines two string sets.
|
||||
func Union(setA, setB []string, ignoreCase bool) []string {
|
||||
for _, b := range setB {
|
||||
if ignoreCase {
|
||||
|
@ -18,7 +19,7 @@ func Union(setA, setB []string, ignoreCase bool) []string {
|
|||
return setA
|
||||
}
|
||||
|
||||
// Exists checks if a string is in a set
|
||||
// Exists checks if a string is in a set.
|
||||
func Exists(set []string, find string) bool {
|
||||
for _, s := range set {
|
||||
if s == find {
|
||||
|
@ -28,7 +29,7 @@ func Exists(set []string, find string) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
// ExistsIgnoreCase checks if a string is in a set but ignores its case
|
||||
// ExistsIgnoreCase checks if a string is in a set but ignores its case.
|
||||
func ExistsIgnoreCase(set []string, find string) bool {
|
||||
find = strings.ToLower(find)
|
||||
for _, s := range set {
|
||||
|
|
Loading…
Reference in New Issue