coreinterface, handlerinterface, event, eventhandler

This commit is contained in:
Darko Luketic 2019-01-16 04:19:11 +01:00
parent 6d2f5d05c7
commit c9f3abd8b9
3 changed files with 62 additions and 0 deletions

10
events.go Normal file
View File

@ -0,0 +1,10 @@
package main
type Event struct {
Name string
Callback func(params ...interface{})
}
type EventHandler struct {
EventC <-chan *Event
}

45
interfaces.go Normal file
View File

@ -0,0 +1,45 @@
package main
type CoreInterface interface {
BeforeLoadPlugins()
LoadPlugins()
AfterLoadPlugins()
BeforeLoadConfiguration()
LoadConfiguration()
AfterLoadConfiguration()
BeforeConnectToDatabases()
ConnectToDatabases()
AfterConnectToDatabases()
BeforeSetupLogger()
SetupLogger()
AfterSetupLogger()
BeforeSetupRoutes()
SetupRoutes()
AfterSetupRoutes()
BeforeRun()
Run()
AfterRun()
}
type HandlerInterface interface {
BeforeProcessRequest()
ProcessRequest()
AfterProcessRequest()
BeforeLoadDataFromDatabase()
LoadDataFromDatabase()
AfterLoadDataFromDatabase()
BeforeSaveDataToDatabase()
SaveDataToDatabase()
AfterSaveDataToDatabase()
BeforeRenderOutput()
RenderOutput()
AfterRenderOutput()
}

7
main.go Normal file
View File

@ -0,0 +1,7 @@
package main
func main() {
/*
Some way to load the core plugins and the handler plugins
*/
}