Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
Apply all apis to the gin engine @param e: gin.Engine @param autowired: whether enable autowired properties
func GetAnnotation ¶ added in v2.2.0
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
Types ¶
type Annotations ¶ added in v2.2.0
Annotations the annotation of Api method
type Controller ¶
type Controller struct{}
Controller Default abstract controller implementation.
Simply integrate the default controller into your structure.
Example:
type YourController struct { mvc.Controller } // Hello // @GET(path="/hello") this is api method func (y *YourController) Hello(ctx *gin.Context) { resp.Json(ctx, "Hello World") } // Access the API curl http://localhost:4006/hello
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
Click to show internal directories.
Click to hide internal directories.