From 7830f411eb9083dfd755b82c3068d686ec893114 Mon Sep 17 00:00:00 2001 From: Todd Persen <todd.persen@gmail.com> Date: Thu, 26 Feb 2015 20:25:32 -0800 Subject: [PATCH] Remove `util.go` because it's not being used anymore. --- util.go | 96 --------------------------------------------------------- 1 file changed, 96 deletions(-) delete mode 100644 util.go diff --git a/util.go b/util.go deleted file mode 100644 index bb55e6a017..0000000000 --- a/util.go +++ /dev/null @@ -1,96 +0,0 @@ -package influxdb - -import ( - "fmt" - - "code.google.com/p/log4go" -) - -// TimePrecision represents a level of time precision. -type TimePrecision int - -const ( - // MicrosecondPrecision is 1/1,000,000 th of a second. - MicrosecondPrecision TimePrecision = iota - // MillisecondPrecision is 1/1,000 th of a second. - MillisecondPrecision - // SecondPrecision is 1 second precision. - SecondPrecision -) - -func parseTimePrecision(s string) (TimePrecision, error) { - switch s { - case "u": - return MicrosecondPrecision, nil - case "m": - log4go.Warn("time_precision=m will be disabled in future release, use time_precision=ms instead") - fallthrough - case "ms": - return MillisecondPrecision, nil - case "s": - return SecondPrecision, nil - case "": - return MillisecondPrecision, nil - } - - return 0, fmt.Errorf("Unknown time precision %s", s) -} - -func hasDuplicates(ss []string) bool { - m := make(map[string]struct{}, len(ss)) - for _, s := range ss { - if _, ok := m[s]; ok { - return true - } - m[s] = struct{}{} - } - return false -} - -func removeField(fields []string, name string) []string { - index := -1 - for idx, field := range fields { - if field == name { - index = idx - break - } - } - - if index == -1 { - return fields - } - - return append(fields[:index], fields[index+1:]...) -} - -func removeTimestampFieldDefinition(fields []string) []string { - fields = removeField(fields, "time") - return removeField(fields, "sequence_number") -} - -func mapKeyList(m interface{}) []string { - - switch m.(type) { - case map[string]string: - return mapStrStrKeyList(m.(map[string]string)) - case map[string]uint32: - return mapStrUint32KeyList(m.(map[string]uint32)) - } - return nil -} - -func mapStrStrKeyList(m map[string]string) []string { - l := make([]string, 0, len(m)) - for k := range m { - l = append(l, k) - } - return l -} - -func mapStrUint32KeyList(m map[string]uint32) []string { - l := make([]string, 0, len(m)) - for k := range m { - l = append(l, k) - } - return l -}