Support BuntDB engine.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu
2016-08-02 15:35:28 +08:00
parent dd1fb29e6b
commit b13fd54ba3
8 changed files with 221 additions and 10 deletions

View File

@@ -67,6 +67,7 @@ type SectionStat struct {
Engine string `yaml:"engine"`
Redis SectionRedis `yaml:"redis"`
BoltDB SectionBoltDB `yaml:"boltdb"`
BuntDB SectionBuntDB `yaml:"buntdb"`
}
// SectionRedis is sub seciont of config.
@@ -82,6 +83,11 @@ type SectionBoltDB struct {
Bucket string `yaml:"bucket"`
}
// SectionBuntDB is sub seciont of config.
type SectionBuntDB struct {
Path string `yaml:"path"`
}
// BuildDefaultPushConf is default config setting.
func BuildDefaultPushConf() ConfYaml {
var conf ConfYaml
@@ -130,6 +136,8 @@ func BuildDefaultPushConf() ConfYaml {
conf.Stat.BoltDB.Path = "gorush.db"
conf.Stat.BoltDB.Bucket = "gorush"
conf.Stat.BuntDB.Path = "gorush.db"
return conf
}

View File

@@ -43,3 +43,5 @@ stat:
boltdb:
path: "gorush.db"
bucket: "gorush"
buntdb:
path: "gorush.db"

View File

@@ -96,6 +96,8 @@ func (suite *ConfigTestSuite) TestValidateConfDefault() {
assert.Equal(suite.T(), "gorush.db", suite.ConfGorushDefault.Stat.BoltDB.Path)
assert.Equal(suite.T(), "gorush", suite.ConfGorushDefault.Stat.BoltDB.Bucket)
assert.Equal(suite.T(), "gorush.db", suite.ConfGorushDefault.Stat.BuntDB.Path)
}
func (suite *ConfigTestSuite) TestValidateConf() {
@@ -142,6 +144,8 @@ func (suite *ConfigTestSuite) TestValidateConf() {
assert.Equal(suite.T(), "gorush.db", suite.ConfGorush.Stat.BoltDB.Path)
assert.Equal(suite.T(), "gorush", suite.ConfGorush.Stat.BoltDB.Bucket)
assert.Equal(suite.T(), "gorush.db", suite.ConfGorush.Stat.BuntDB.Path)
}
func TestConfigTestSuite(t *testing.T) {