From c9f3abd8b941bd7e384a0cc3609bbfd71aba76c9 Mon Sep 17 00:00:00 2001 From: Darko Luketic <2694548+dalu@users.noreply.github.com> Date: Wed, 16 Jan 2019 04:19:11 +0100 Subject: [PATCH] coreinterface, handlerinterface, event, eventhandler --- events.go | 10 ++++++++++ interfaces.go | 45 +++++++++++++++++++++++++++++++++++++++++++++ main.go | 7 +++++++ 3 files changed, 62 insertions(+) create mode 100644 events.go create mode 100644 interfaces.go create mode 100644 main.go diff --git a/events.go b/events.go new file mode 100644 index 0000000..4673b3e --- /dev/null +++ b/events.go @@ -0,0 +1,10 @@ +package main + +type Event struct { + Name string + Callback func(params ...interface{}) +} + +type EventHandler struct { + EventC <-chan *Event +} diff --git a/interfaces.go b/interfaces.go new file mode 100644 index 0000000..f155f6b --- /dev/null +++ b/interfaces.go @@ -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() +} diff --git a/main.go b/main.go new file mode 100644 index 0000000..e721569 --- /dev/null +++ b/main.go @@ -0,0 +1,7 @@ +package main + +func main() { + /* + Some way to load the core plugins and the handler plugins + */ +}