controller

package
v0.0.0-...-d817ec6 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Copyright 2019-2020 Axetroy. All rights reserved. Apache License 2.0.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Router

func Router(ctrl controllerFunc) func(c *gin.Context)

Types

type Context

type Context struct {
	Uid       string `json:"uid"`        // 操作人的用户 ID
	UserAgent string `json:"user_agent"` // 用户代理
	Ip        string `json:"ip"`         // IP地址
	// contains filtered or unexported fields
}

控制器的上下文

func NewContext

func NewContext(c *gin.Context) Context

func (*Context) GetHeader

func (c *Context) GetHeader(key string) string

func (*Context) GetParam

func (c *Context) GetParam(key string) string

func (*Context) GetQuery

func (c *Context) GetQuery(key string) string

func (*Context) SetHeader

func (c *Context) SetHeader(key, value string)

func (*Context) ShouldBindJSON

func (c *Context) ShouldBindJSON(inputPointer interface{}) error

校验 body 中的 JSON 字段

func (*Context) ShouldBindQuery

func (c *Context) ShouldBindQuery(inputPointer interface{}) error

校验 url 中的 query

Jump to

Keyboard shortcuts

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