mvc

package
v3.3.9 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(e *gin.Engine, autowired bool)

Apply attaches all APIs to the Gin engine. @param e: the Gin engine. @param autowired: if true, enables property injection via IoC.

func GetAnnotation

func GetAnnotation(ctx *gin.Context, annotationName string) (val string, has bool)

GetAnnotation retrieves the specified annotation from the current context. Returns the annotation value and a boolean indicating whether the annotation exists.

func IsController

func IsController(v interface{}) bool

IsController checks if a given value implements the abstractController interface.

func Register

func Register(controllers ...abstractController)

Register adds controllers to the global cache.

Types

type Annotations

type Annotations map[string]string

Annotations represents the annotations of an API method.

type Controller

type Controller struct{}

Controller is a base struct that declares an entity as a controller. API methods can be added to this struct.

func (*Controller) PostConstruct

func (c *Controller) PostConstruct()

PostConstruct is a default implementation for Controller.

type MethodInterceptor

type MethodInterceptor interface {
	// Predicate determines whether to intercept the request.
	Predicate(ctx *gin.Context) bool

	// PreHandle is triggered before the API method is invoked.
	// If you want to abort the current request, call ctx.Abort() and handle the response inside this method.
	PreHandle(ctx *gin.Context)

	// PostHandle is triggered after the API method is invoked.
	// If you want to abort the current request, call ctx.Abort() and handle the response inside this method.
	PostHandle(ctx *gin.Context)
}

MethodInterceptor allows for pre- and post-processing of API method calls.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳