file

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Merge 重写验证器结构体,切记不使用引用,而是拷贝

View Source
var Prepare = validates.Validates{Validate: PrepareValidate{}}

Prepare 重写验证器结构体,切记不使用引用,而是拷贝

Functions

func Check

func Check(ctx *gin.Context) (files []*multipart.FileHeader)

Check 小文件上传验证方法 @param *gin.Context ctx 上下文对象 @return void

func ChunkCheck

func ChunkCheck(ctx *gin.Context, data map[string]interface{}) (map[string]interface{}, *multipart.FileHeader)

ChunkCheck 分片上传验证方法 @param *gin.Context ctx 上下文对象 @param map[string]interface{} data 请求参数 @return map[string]interface{} *multipart.FileHeader 转换后的map和文件对象

func Validate

func Validate(files []*multipart.FileHeader) error

Validate 文件验证器 @param []*multipart.FileHeader files 文件列表 @return err 返回错误信息

Types

type ChunkMergeValidate

type ChunkMergeValidate struct {
	FileId uint `json:"fileId" validate:"required" label:"文件ID"`
}

ChunkMergeValidate 分片合并验证器规则

type ChunkUploadValidate

type ChunkUploadValidate struct {
	FileId      uint  `json:"fileId" validate:"required" label:"文件ID"`
	ChunkNumber uint8 `json:"chunkNumber" validate:"required" label:"分片编号"`
	Hash        uint8 `json:"hash" validate:"required" label:"文件块校验和"`
}

ChunkUploadValidate 分片上传验证器规则

type PrepareValidate

type PrepareValidate struct {
	FileName string `json:"fileName" validate:"required,max=255" label:"文件名称"`
	FileExt  string `json:"fileExt" validate:"required,max=30" label:"文件扩展名"`
	FileType string `json:"fileType" validate:"required,max=30" label:"文件MIME类型"`
	Hash     string `json:"hash" validate:"required,md5" label:"文件校验和"`
	FileSize uint64 `json:"fileSize" validate:"required,number" label:"文件大小"`
}

PrepareValidate 管理员添加验证规则

Jump to

Keyboard shortcuts

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