graceful shutdown, CoreInterface changes, MongoDB official driver is the only DB backend
This commit is contained in:
@ -1,9 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/globalsign/mgo"
|
||||
"github.com/jinzhu/gorm"
|
||||
)
|
||||
import "go.mongodb.org/mongo-driver/mongo"
|
||||
|
||||
type CoreInterface interface {
|
||||
Register() (string, error)
|
||||
@ -17,20 +14,9 @@ type CoreInterface interface {
|
||||
LoadConfiguration() error
|
||||
AfterLoadConfiguration() error
|
||||
|
||||
// connection string parameter e.g. "localhost"
|
||||
ConnectMongoDB(string) (*mgo.Session, error)
|
||||
|
||||
// connection string parameter
|
||||
ConnectGORM(string) (*gorm.DB, error)
|
||||
|
||||
// ConnectNeo4j
|
||||
// ConnectArangoDB
|
||||
// ConnectCassandra
|
||||
// ConnectDGraph
|
||||
|
||||
BeforeConnectToDatabases() error
|
||||
ConnectToDatabases() error
|
||||
AfterConnectToDatabases() error
|
||||
BeforeDatabaseInit() error
|
||||
DatabaseInit() error
|
||||
AfterDatabaseInit() error
|
||||
|
||||
BeforeSetupLogger() error
|
||||
SetupLogger() error
|
||||
@ -43,6 +29,14 @@ type CoreInterface interface {
|
||||
BeforeRun() error
|
||||
Run() error
|
||||
AfterRun() error
|
||||
|
||||
BeforeShutdown() error
|
||||
Shutdown() error
|
||||
}
|
||||
|
||||
type DatabaseInterface interface {
|
||||
Client() *mongo.Client
|
||||
Close() error
|
||||
}
|
||||
|
||||
type HandlerInterface interface {
|
||||
|
Reference in New Issue
Block a user