示例#1
0
文件: servers.go 项目: e8vm/shanhu
// E8VM opens the storage layer for e8vm.io
func E8VM(c *shanhu.Config) (*shanhu.Storage, error) {
	repoDB, err := repodb.Open(c.MysqlDB)
	if err != nil {
		return nil, err
	}

	return &shanhu.Storage{
		RepoDB: repoDB,
	}, nil
}
示例#2
0
文件: main.go 项目: e8vm/shanhu
func openDB() repodb.DB {
	if *useMysql {
		db, err := repomy.Open(*dbPath)
		if err != nil {
			log.Fatal(err)
		}
		return db
	}

	db, err := repolite.Open(*dbPath)
	if err != nil {
		log.Fatal(err)
	}
	return db
}