router

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	Routes(route *gin.RouterGroup)
	GlobalMiddlewares() []gin.HandlerFunc
	InitializeServices() error
	AreServicesInitialized() bool
	FinalizeServices() error
}

API should implement the routes logic and services that will be associated with the router as well as eventual default middleware (the order matters)

type Router

type Router struct {
	// contains filtered or unexported fields
}

Router represent a Router instance registered middleware :

  • gin.Recovery

func NewRouter

func NewRouter(l *log.Log, api API) *Router

NewRouter creates a new Router structure with the given parameters.

func (*Router) Finalize

func (r *Router) Finalize() error

Finalize releases the resources held by the router.

func (*Router) GetEngine

func (r *Router) GetEngine() *gin.Engine

GetEngine returns the gin engine instance associated with the Router object. Panics if the object is not initialized.

func (*Router) Initialize

func (r *Router) Initialize() error

Initialize initializes the Router structure.

func (*Router) IsInitialized

func (r *Router) IsInitialized() bool

IsInitialized returns whether the router is initialized.

Jump to

Keyboard shortcuts

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