cServer

package module
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInstance

func GetInstance(index string) interface{}

func Inject

func Inject(instance interface{})

func Load

func Load()

func StartHTTP

func StartHTTP()

Types

type ApplicationContainer

type ApplicationContainer struct {
	ExitChannel    chan os.Signal
	HttpServer     *gin.Engine
	HttpServerConf *ApplicationContainer_HttpServerConf
	Routes         []*ApplicationContainer_Route
}

func (ApplicationContainer) ListenExitChannel

func (app ApplicationContainer) ListenExitChannel()

type ApplicationContainer_HttpServerConf

type ApplicationContainer_HttpServerConf struct {
	Enable         bool
	Port           int
	ReadTimeout    int
	WriteTimeout   int
	ExitTimeout    int
	MaxHeaderBytes int
}

type ApplicationContainer_Route

type ApplicationContainer_Route struct {
	Path              string
	Method            string
	Handler           gin.HandlerFunc
	PrefixMiddlewares []gin.HandlerFunc
	SurfixMiddlewares []gin.HandlerFunc
}

type RouteConf

type RouteConf struct {
	Path              string                  `json:"path"`
	Method            string                  `json:"method"`
	Controller        string                  `json:"controller"`
	Function          string                  `json:"function"`
	PrefixMiddlewares []*RouteConf_Middleware `json:"prefix_middlewares"`
	SurfixMiddlewares []*RouteConf_Middleware `json:"surfix_middlewares"`
	Routes            []*RouteConf            `json:"routes"`
}

func (*RouteConf) ConfigName

func (i *RouteConf) ConfigName() string

type RouteConf_Middleware

type RouteConf_Middleware struct {
	Middleware string `json:"middleware"`
	Function   string `json:"function"`
}

type ServerConf

type ServerConf struct {
	GoMod      string                 `json:"go_mod"`
	HttpServer *ServerConf_HttpServer `json:"http_server"`
}

func (*ServerConf) ConfigName

func (i *ServerConf) ConfigName() string

type ServerConf_HttpServer

type ServerConf_HttpServer struct {
	Enable         bool `json:"enable"`
	Port           int  `json:"port"`
	ReadTimeout    int  `json:"read_timeout"`
	WriteTimeout   int  `json:"write_timeout"`
	ExitTimeout    int  `json:"exit_timeout"`
	MaxHeaderBytes int  `json:"max_header_bytes"`
}

type ServerContainer

type ServerContainer struct {
	Lock      *sync.Mutex
	Instances map[string]interface{}
}

func (*ServerContainer) Clear

func (i *ServerContainer) Clear()

func (*ServerContainer) Get

func (i *ServerContainer) Get(index string) interface{}

func (*ServerContainer) Remove

func (i *ServerContainer) Remove(instance interface{})

func (*ServerContainer) Save

func (i *ServerContainer) Save(instance interface{})

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL