Documentation
¶
Overview ¶
* utils.go --- Utility functions. * * Copyright (c) 2021 Paul Ward <asmodai@gmail.com> * * Author: Paul Ward <asmodai@gmail.com> * Maintainer: Paul Ward <asmodai@gmail.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 3 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>.
Index ¶
- func CORSMiddleware() gin.HandlerFunc
- func GetRouter(mgr process.IManager) (*gin.Engine, error)
- func SetDebugMode(debug bool)
- func Spawn(mgr process.IManager, lgr logger.ILogger, config *Config) (*process.Process, error)
- type Config
- type Dispatcher
- type DispatcherProc
- type Document
- type ErrorDocument
- type IServer
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CORSMiddleware ¶
func CORSMiddleware() gin.HandlerFunc
func SetDebugMode ¶
func SetDebugMode(debug bool)
Types ¶
type Config ¶
type Config struct {
Addr string `json:"address"`
Cert string `json:"cert_file"`
Key string `json:"key_file"`
UseTLS bool `json:"use_tls"`
LogFile string `json:"log_file"`
}
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
func NewDefaultDispatcher ¶
func NewDefaultDispatcher() *Dispatcher
func NewDispatcher ¶
func NewDispatcher(lgr logger.ILogger, config *Config) *Dispatcher
func (*Dispatcher) GetRouter ¶
func (d *Dispatcher) GetRouter() *gin.Engine
func (*Dispatcher) Start ¶
func (d *Dispatcher) Start()
func (*Dispatcher) Stop ¶
func (d *Dispatcher) Stop()
type DispatcherProc ¶
func NewDispatcherProc ¶
func NewDispatcherProc(lgr logger.ILogger, config *Config) *DispatcherProc
func (*DispatcherProc) Action ¶
func (p *DispatcherProc) Action(state **process.State)
type Document ¶
type Document struct {
Data interface{} `json:"data"`
Error *ErrorDocument `json:"error"`
Elapsed string `json:"elapsed_time",omitempty`
// contains filtered or unexported fields
}
func NewDocument ¶
func NewErrorDocument ¶
func (*Document) SetError ¶
func (d *Document) SetError(err *ErrorDocument)
type ErrorDocument ¶
func NewError ¶
func NewError(status int, msg string) *ErrorDocument
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewDefaultServer ¶
func NewDefaultServer() *Server