Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppShutdownFunc ¶
type AppShutdownFunc func(notifyEmail string)
type DatabaseShutdownFunc ¶
type NetworkShutdownFunc ¶
type NetworkShutdownFunc func(hostaddresses []string)
type RouterShutdownFunc ¶
type ServerApp ¶
type ServerApp struct { Router *mux.Router Database *sql.DB ShutdownFuncs ShutdownFuncs // contains filtered or unexported fields }
App is the main application object and must implement all methods of ServerApp
var Svr *ServerApp
func (*ServerApp) InitDatabase ¶
func (app *ServerApp) InitDatabase()
InitDatabase called by Startup to initialize the apps database (if any)
func (*ServerApp) InitRouter ¶
func (app *ServerApp) InitRouter()
InitRouter called by Startup to initialize all routes handled by app
type ServerAppInterface ¶
type ServerAppInterface interface { // Startup calls Init* methods and displays standard app header Startup() // InitEnvironment called by Startup to intiialize apps environment variables InitEnvironment() // InitConfig called by Startup to load the apps configuration InitConfig() // InitFlags called by Startup to process the apps flags which can be used to override // Environment and Config InitFlags() // InitDatabase called by Startup to initialize the apps database (if any) InitDatabase() // InitRouter called by Startup to initialize all routes handled by app InitRouter() // Listen Invoke after Startup with no errors to handle the main loop as well as // a graceful shutdown Listen() // Shutdown is called from Listen does not need to be called directly Shutdown() }
ServerApp defines the reguired functions that need to be implemented
type ServerAppState ¶
type ServerAppState int
const ( AppStateUnknown ServerAppState = 0 AppStateInitializing ServerAppState = 1 AppStateInitialized ServerAppState = 2 AppStateOnline ServerAppState = 3 AppStateOffline ServerAppState = 4 AppStateShuttingDown ServerAppState = 5 AppStateShutdown ServerAppState = 6 AppStateExiting ServerAppState = 7 )
type ServerConfig ¶
type ShutdownFuncs ¶
type ShutdownFuncs struct { RouterFunc RouterShutdownFunc Database DatabaseShutdownFunc Network NetworkShutdownFunc Application AppShutdownFunc }
Click to show internal directories.
Click to hide internal directories.