package storage import "strings" type DB interface { Get(string) ([]byte, error) Set(string, []byte) error Close() error } var DefaultNamespace = "namespace" 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 "" } 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) } func New(key Type) (DB, error) { return nil, ErrNotImpl }