-
Notifications
You must be signed in to change notification settings - Fork 0
/
files.go
50 lines (42 loc) · 1.3 KB
/
files.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// Copyright 2019 Waleed AlMalki. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package reqtruct
import (
"reflect"
)
func isFileHeadersPtrs(t reflect.Type) bool {
return t.Kind() == reflect.Slice &&
t.Elem().Kind() == reflect.Ptr &&
t.Elem().Elem().Kind() == reflect.Struct &&
t.Elem().Elem().PkgPath() == "mime/multipart" &&
t.Elem().Elem().Name() == "FileHeader"
}
func isFileHeaderPtr(t reflect.Type) bool {
return t.Kind() == reflect.Ptr &&
t.Elem().Kind() == reflect.Struct &&
t.Elem().PkgPath() == "mime/multipart" &&
t.Elem().Name() == "FileHeader"
}
func isFileHeaders(t reflect.Type) bool {
return t.Kind() == reflect.Slice &&
t.Elem().Kind() == reflect.Struct &&
t.Elem().PkgPath() == "mime/multipart" &&
t.Elem().Name() == "FileHeader"
}
func isFileHeader(t reflect.Type) bool {
return t.Kind() == reflect.Struct &&
t.PkgPath() == "mime/multipart" &&
t.Name() == "FileHeader"
}
func isFiles(t reflect.Type) bool {
return t.Kind() == reflect.Slice &&
t.Elem().Kind() == reflect.Interface &&
t.Elem().PkgPath() == "mime/multipart" &&
t.Elem().Name() == "File"
}
func isFile(t reflect.Type) bool {
return t.Kind() == reflect.Interface &&
t.PkgPath() == "mime/multipart" &&
t.Name() == "File"
}