Documentation ¶
Index ¶
- Variables
- func Check(ctx *gin.Context) (files []*multipart.FileHeader)
- func ChunkCheck(ctx *gin.Context, data map[string]interface{}) (map[string]interface{}, *multipart.FileHeader)
- func Validate(files []*multipart.FileHeader) error
- type ChunkMergeValidate
- type ChunkUploadValidate
- type PrepareValidate
Constants ¶
This section is empty.
Variables ¶
View Source
var Merge = validates.Validates{Validate: ChunkMergeValidate{}}
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 管理员添加验证规则
Click to show internal directories.
Click to hide internal directories.