cServer

package module
v0.0.200 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2023 License: MIT Imports: 25 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 InjectConf added in v0.0.52

func InjectConf(conf interface{})

func InjectView added in v0.0.52

func InjectView(name string, fs *assetfs.AssetFS)

func Load

func Load()

func RequestDataHandlerFunc added in v0.0.9

func RequestDataHandlerFunc(ctx *gin.Context)

func StartHTTP

func StartHTTP()

Types

type ApplicationContainer

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

func (ApplicationContainer) ListenExitChannel

func (app ApplicationContainer) ListenExitChannel()

type ApplicationContainer_HttpServerConf

type ApplicationContainer_HttpServerConf struct {
	Enable          bool
	Debug           bool
	Port            int
	ReadTimeout     int
	WriteTimeout    int
	ExitTimeout     int
	MaxHeaderBytes  int
	BasicAuthEnable bool
	BasicAuthUsers  map[string]string
}

type ApplicationContainer_Route

type ApplicationContainer_Route struct {
	Path              string
	Method            []string
	File              string
	Dir               string
	View              *assetfs.AssetFS
	Type              RouteType
	Handler           gin.HandlerFunc
	PrefixMiddlewares []gin.HandlerFunc
	SurfixMiddlewares []gin.HandlerFunc
}

type RouteConf

type RouteConf struct {
	Path        string                 `json:"path"`
	Method      []string               `json:"method"`
	File        string                 `json:"file"`
	Dir         string                 `json:"dir"`
	View        string                 `json:"view"`
	App         string                 `json:"app"`
	Controller  string                 `json:"controller"`
	Function    string                 `json:"function"`
	Middlewares *RouteConf_Middlewares `json:"middlewares"`
	Routes      []*RouteConf           `json:"routes"`
}

func GetRouteConf added in v0.0.52

func GetRouteConf() *RouteConf

func (*RouteConf) ConfigName

func (i *RouteConf) ConfigName() string

type RouteConf_Middleware

type RouteConf_Middleware struct {
	App  string `json:"app"`
	Name string `json:"name"`
}

type RouteConf_Middlewares added in v0.0.7

type RouteConf_Middlewares struct {
	Prefix []*RouteConf_Middleware `json:"prefix"`
	Surfix []*RouteConf_Middleware `json:"surfix"`
}

type RouteType added in v0.0.52

type RouteType uint8
const (
	RouteTypeHandler RouteType = iota
	RouteTypeFile
	RouteTypeDir
	RouteTypeView
)

type ServerConf

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

func GetServerConf added in v0.0.52

func GetServerConf() *ServerConf

func (*ServerConf) ConfigName

func (i *ServerConf) ConfigName() string

type ServerConf_HttpServer

type ServerConf_HttpServer struct {
	Enable          bool              `json:"enable"`
	Debug           bool              `json:"debug"`
	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"`
	BasicAuthEnable bool              `json:"basic_auth_enable"`
	BasicAuthUsers  map[string]string `json:"basic_auth_users"`
}

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{})

type ViewsContainer added in v0.0.52

type ViewsContainer struct {
	Lock  *sync.Mutex
	Views map[string]*assetfs.AssetFS
}

func (*ViewsContainer) Get added in v0.0.52

func (c *ViewsContainer) Get(name string) *assetfs.AssetFS

func (*ViewsContainer) Save added in v0.0.52

func (c *ViewsContainer) Save(name string, fs *assetfs.AssetFS)

Jump to

Keyboard shortcuts

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