CoreInterface remodel, PluginRegistry added
This commit is contained in:
153
core/base/base.go
Normal file
153
core/base/base.go
Normal file
@ -0,0 +1,153 @@
|
||||
package base
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/globalsign/mgo"
|
||||
"github.com/jinzhu/gorm"
|
||||
)
|
||||
|
||||
type Base struct{}
|
||||
|
||||
func (b *Base) Register() (string, error) {
|
||||
if e := b.BeforeLoadPlugins(); e != nil {
|
||||
return "", e
|
||||
}
|
||||
if e := b.LoadPlugins(); e != nil {
|
||||
return "", e
|
||||
}
|
||||
if e := b.AfterLoadPlugins(); e != nil {
|
||||
return "", e
|
||||
}
|
||||
if e := b.BeforeLoadConfiguration(); e != nil {
|
||||
return "", e
|
||||
}
|
||||
if e := b.LoadConfiguration(); e != nil {
|
||||
return "", e
|
||||
}
|
||||
if e := b.AfterLoadConfiguration(); e != nil {
|
||||
return "", e
|
||||
}
|
||||
if e := b.BeforeConnectToDatabases(); e != nil {
|
||||
return "", e
|
||||
}
|
||||
if e := b.ConnectToDatabases(); e != nil {
|
||||
return "", e
|
||||
}
|
||||
if e := b.AfterConnectToDatabases(); e != nil {
|
||||
return "", e
|
||||
}
|
||||
if e := b.BeforeSetupLogger(); e != nil {
|
||||
return "", e
|
||||
}
|
||||
if e := b.SetupLogger(); e != nil {
|
||||
return "", e
|
||||
}
|
||||
if e := b.AfterSetupLogger(); e != nil {
|
||||
return "", e
|
||||
}
|
||||
if e := b.BeforeSetupRoutes(); e != nil {
|
||||
return "", e
|
||||
}
|
||||
if e := b.SetupRoutes(); e != nil {
|
||||
return "", e
|
||||
}
|
||||
if e := b.AfterSetupRoutes(); e != nil {
|
||||
return "", e
|
||||
}
|
||||
if e := b.BeforeRun(); e != nil {
|
||||
return "", e
|
||||
}
|
||||
if e := b.Run(); e != nil {
|
||||
return "", e
|
||||
}
|
||||
if e := b.AfterRun(); e != nil {
|
||||
return "", e
|
||||
}
|
||||
return "base", nil
|
||||
}
|
||||
|
||||
func (b *Base) UnRegister() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Base) BeforeLoadPlugins() error {
|
||||
fmt.Println("Hello World. BeforeLoadPlugins")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Base) LoadPlugins() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Base) AfterLoadPlugins() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Base) BeforeLoadConfiguration() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Base) LoadConfiguration() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Base) AfterLoadConfiguration() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Base) ConnectMongoDB(string) (*mgo.Session, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (b *Base) ConnectGORM(string) (*gorm.DB, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (b *Base) BeforeConnectToDatabases() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Base) ConnectToDatabases() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Base) AfterConnectToDatabases() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Base) BeforeSetupLogger() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Base) SetupLogger() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Base) AfterSetupLogger() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Base) BeforeSetupRoutes() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Base) SetupRoutes() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Base) AfterSetupRoutes() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Base) BeforeRun() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Base) Run() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *Base) AfterRun() error {
|
||||
return nil
|
||||
}
|
Reference in New Issue
Block a user