split out test

This commit is contained in:
Bel LaPointe
2019-03-14 14:28:37 -06:00
parent 10e02bac31
commit b79cb97ba6
2 changed files with 49 additions and 44 deletions

48
type.go Normal file
View File

@@ -0,0 +1,48 @@
package storage
import (
"strings"
)
type Type int
const (
MAP = Type(iota)
BOLT = Type(iota)
CACHE = Type(iota)
LEVELDB = Type(iota)
MEMCACHE = Type(iota)
MEMCACHECLUSTER = Type(iota)
MONGO = Type(iota)
)
func (t Type) String() string {
switch t {
case MAP:
return "map"
case BOLT:
return "bolt"
case CACHE:
return "cache"
case LEVELDB:
return "leveldb"
case MEMCACHE:
return "memcache"
case MEMCACHECLUSTER:
return "memcachecluster"
case MONGO:
return "mongo"
}
return "<unknown>"
}
func TypeFromString(key string) Type {
key = strings.ToLower(key)
for i := 0; i < 30; i++ {
t := Type(i)
if t.String() == key {
return t
}
}
return Type(-1)
}