mvc

package
v3.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 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 all apis to the gin engine @param e: gin.Engine @param autowired: whether enable autowired properties

func GetAnnotation

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

GetAnnotation Gets the specified annotation Returns the value of this annotation, when the has is false mine this val is empty

func IsController

func IsController(v interface{}) bool

IsController Determine whether it is controller

func Register

func Register(controller ...abstractController)

Register controllers

Types

type Annotations

type Annotations map[string]string

Annotations the annotation of Api method

type Controller

type Controller struct{}

Controller Declares the structure to be a controller you can add api methods to it

func (*Controller) PostConstruct

func (c *Controller) PostConstruct()

type MethodInterceptor

type MethodInterceptor interface {
	// Predicate true means intercept
	Predicate(ctx *gin.Context) bool

	// PreHandle triggered before method invocation
	// if you want to abort the current request, just call abort() and response inside the method
	PreHandle(ctx *gin.Context)

	// PostHandle triggered after method invocation
	// if you want to abort the current request, just call abort() and response inside the method
	PostHandle(ctx *gin.Context)
}

MethodInterceptor API method interceptor You can do logical processing before and after method calls

Jump to

Keyboard shortcuts

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