Documentation
¶
Overview ¶
* utils.go --- Utility functions. * * Copyright (c) 2021-2022 Paul Ward <asmodai@gmail.com> * * Author: Paul Ward <asmodai@gmail.com> * Maintainer: Paul Ward <asmodai@gmail.com> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation files * (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE.
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