67 lines
1.1 KiB
Go
Executable File
67 lines
1.1 KiB
Go
Executable File
package storage
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
type Type int
|
|
|
|
const (
|
|
MAP = Type(iota)
|
|
REDIS = Type(iota)
|
|
DYNOMITE = Type(iota)
|
|
BOLT = Type(iota)
|
|
FILES = Type(iota)
|
|
COCKROACH = Type(iota)
|
|
CACHE = Type(iota)
|
|
LEVELDB = Type(iota)
|
|
MEMCACHE = Type(iota)
|
|
MEMCACHECLUSTER = Type(iota)
|
|
MONGO = Type(iota)
|
|
MINIO = Type(iota)
|
|
RCLONE = Type(iota)
|
|
)
|
|
|
|
func (t Type) String() string {
|
|
switch t {
|
|
case DYNOMITE:
|
|
return "dynomite"
|
|
case REDIS:
|
|
return "redis"
|
|
case MAP:
|
|
return "map"
|
|
case RCLONE:
|
|
return "rclone"
|
|
case COCKROACH:
|
|
return "cockroach"
|
|
case FILES:
|
|
return "files"
|
|
case BOLT:
|
|
return "bolt"
|
|
case MINIO:
|
|
return "minio"
|
|
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)
|
|
}
|