interceptor

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

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

Go to latest
Published: Feb 24, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(ctx context.Context) error

鉴权逻辑

func Validate

func Validate(req interface{}) (err error)

验证器 - 验证参数是否合法 如果接口是内部使用的,其实可以不用加验证器,把验证放到api层去做 req.UserReq 可以满足userReq的验证,所有的接口,但是还有其他的接口那怎么办 为什么要断言成接口,因为需要满足请求的结构体,所以不能写死一个类型的断言 所以断言成接口,接口里有valodate的方法就能使用了

Types

type Validator

type Validator interface {
	Validate() error
}

Jump to

Keyboard shortcuts

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