controller

package
v0.0.36 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Resources = &Controllers{
	Controllers: []Controller{},
}

Functions

func AddController

func AddController(c Controller)

func AddControllers

func AddControllers(cs ...Controller)

func EnableLocale added in v0.0.27

func EnableLocale() gin.HandlerFunc

func InitRouter

func InitRouter(engine *gin.Engine)

func SetGlobalContext added in v0.0.3

func SetGlobalContext() gin.HandlerFunc

func Start

func Start()

Types

type Controller

type Controller interface {
	InitRouter(*gin.RouterGroup) *gin.RouterGroup
}

type Controllers

type Controllers struct {
	Base        string
	Handlers    []gin.HandlerFunc
	Controllers []Controller
}

func (*Controllers) AddController

func (s *Controllers) AddController(c ...Controller)

func (*Controllers) AddHandler

func (s *Controllers) AddHandler(h ...gin.HandlerFunc)

func (*Controllers) InitRouter

func (s *Controllers) InitRouter(r *gin.RouterGroup) *gin.RouterGroup

interface Controller

type ResourceController

type ResourceController struct {
	Controllers
	ResourceHandlers []ResourceHandler
}

func (*ResourceController) InitRouter

func (c *ResourceController) InitRouter(r *gin.RouterGroup) *gin.RouterGroup

func (*ResourceController) RegisterResourceHandler

func (c *ResourceController) RegisterResourceHandler(h ...ResourceHandler)

func (*ResourceController) RegisterRoute

func (c *ResourceController) RegisterRoute(httpMethod string, path string, handler gin.HandlerFunc)

func (*ResourceController) SetResourceHandlers

func (c *ResourceController) SetResourceHandlers(handlers []ResourceHandler)

type ResourceHandler

type ResourceHandler struct {
	HttpMethod   string
	ResourcePath string
	Handler      gin.HandlerFunc
}

Jump to

Keyboard shortcuts

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