util

package
v0.0.0-...-7e0de9a Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateToken

func CreateToken(uid, uname string) (string, error)

CreateToken 根据用户id生成token

func Logger

func Logger(inner http.Handler, name string) http.Handler

func ParseToken

func ParseToken(token string) (string, string, error)

ParseToken 解析token

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler 封装好的Handler,直接传要返回的东西即可

func CreateHandler

func CreateHandler(w http.ResponseWriter, r *http.Request) *Handler

CreateHandler 封装处理handler

func (*Handler) DecodePath

func (h *Handler) DecodePath(index int) string

DecodePath 读取path数据

func (*Handler) DecodePost

func (h *Handler) DecodePost(body interface{}) error

DecodePost 读取post数据

func (*Handler) DecodeQuery

func (h *Handler) DecodeQuery(key string) string

DecodeQuery 读取query数据

func (*Handler) DecodeToken

func (h *Handler) DecodeToken() string

DecodeToken 读取token

func (*Handler) Send

func (h *Handler) Send(body interface{}, state bool) (err error)

Send 发送数据

Jump to

Keyboard shortcuts

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