web

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2021 License: MIT Imports: 8 Imported by: 0

README

前端页面相关处理

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Store = sessions.NewCookieStore([]byte(viper.GetString("cookie.secret")))

Store It is recommended to use an authentication key with 32 or 64 bytes. The encryption key, if set, must be either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256 modes.

Functions

func Error404

func Error404(c *gin.Context)

Error404 return 404 page

func GetCookieSession

func GetCookieSession(ctx *gin.Context) *sessions.Session

GetCookieSession get cookie

func Index

func Index(c *gin.Context)

Index home page

func Redirect

func Redirect(c *gin.Context, redirectPath, errMsg string)

Redirect redirect to another path

func Request

func Request(ctx *gin.Context) *http.Request

Request return a request

func Response

func Response(c *gin.Context, err error, data interface{})

Response json response

func ResponseWriter

func ResponseWriter(ctx *gin.Context) http.ResponseWriter

ResponseWriter return a response writer

func SetLoginCookie

func SetLoginCookie(ctx *gin.Context, userID uint64)

SetLoginCookie set login cookie to session

Types

type Resp

type Resp struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data"`
}

Resp web response struct

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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