kgin

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option struct {
	Host        string
	Port        int
	Logger      baselogger.Logger
	Middlewares []gin.HandlerFunc
}

Config HTTP config

func AddMiddleware

func AddMiddleware(l gin.HandlerFunc) *Option

func ConfigOption

func ConfigOption(key string) (option *Option, err error)

RawConfig ...

func NewOption

func NewOption() *Option

func SetHost

func SetHost(s string) *Option

func SetLogger

func SetLogger(l baselogger.Logger) *Option

func SetPort

func SetPort(l int) *Option

func (*Option) AddMiddleware

func (c *Option) AddMiddleware(l gin.HandlerFunc) *Option

func (*Option) MergeOption

func (c *Option) MergeOption(opts ...*Option) *Option

func (*Option) SetHost

func (c *Option) SetHost(s string) *Option

func (*Option) SetLogger

func (c *Option) SetLogger(l baselogger.Logger) *Option

func (*Option) SetPort

func (c *Option) SetPort(l int) *Option

type Server

type Server struct {
	*gin.Engine
	Logger baselogger.Logger
	Server *http.Server
	// contains filtered or unexported fields
}

Server ...

func NewServer

func NewServer(opts ...*Option) (s *Server, err error)

func (*Server) GracefulStop

func (s *Server) GracefulStop(ctx context.Context) error

GracefulStop implements server.Server interface it will stop gin server gracefully

func (*Server) Info

func (s *Server) Info() *server.ServiceInfo

func (*Server) Serve

func (s *Server) Serve() error

Serve implements server.Server interface.

func (*Server) Stop

func (s *Server) Stop() error

Stop implements server.Server interface it will terminate gin server immediately

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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