OSDN Git Service

modify NewDB
authorChengcheng Zhang <943420582@qq.com>
Wed, 19 Jun 2019 13:35:20 +0000 (21:35 +0800)
committerChengcheng Zhang <943420582@qq.com>
Wed, 19 Jun 2019 13:35:20 +0000 (21:35 +0800)
database/builder.go [new file with mode: 0644]

diff --git a/database/builder.go b/database/builder.go
new file mode 100644 (file)
index 0000000..ae2f4c8
--- /dev/null
@@ -0,0 +1,14 @@
+package database
+
+import (
+       "github.com/vapor/database/dbutils"
+       dbm "github.com/vapor/database/leveldb"
+)
+
+// NewDB return new DB according to backend, defult is "leveldb"
+func NewDB(name string, backend string, dir string) dbutils.DB {
+       switch backend {
+       default: // default is "leveldb"
+               return dbm.NewDB(name, "leveldb", dir)
+       }
+}