Documentation ¶
Index ¶
- func CopyAndChange(source interface{}, target interface{}) map[string]interface{}
- func CreateFile(FilePath, FileName string) *os.File
- func DeepCopyMap(source interface{}) (target interface{})
- func DownloadInternetImage(url string, UserAgent string, Referer string) string
- func DownloadInternetImageTemp(url string, UserAgent string, Referer string) string
- func FindChange(source interface{}, target interface{}) map[string]interface{}
- func GetAllFieldName(t reflect.Type) []string
- func GetDeviceName(UserAgent string) string
- func GetHardwareAddrs() string
- func GetIP(request *http.Request) string
- func IsFileExist(path string) bool
- func QueryParams(m url.Values) map[string]string
- func RequestByHeader(url string, UserAgent string, Referer string) (error, *http.Response, []byte)
- func UUID() string
- func WriteFile(b []byte, ContentType string) string
- func WriteFilePath(read []byte, subPath string, fileName string) (error, string)
- func WriteTempFile(b []byte, ContentType string) string
- func WriteTempUrlNameFile(b []byte, Url string) string
- func WriteWithFile(file multipart.File, header *multipart.FileHeader, dynamicDirName string) (error, string)
- type FileDirType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyAndChange ¶
func CopyAndChange(source interface{}, target interface{}) map[string]interface{}
func CreateFile ¶
func DeepCopyMap ¶ added in v1.2.4
func DeepCopyMap(source interface{}) (target interface{})
map的深度复制
只支持值类型为:
Array,Slice,元数据类型,不支持struct,map
func DownloadInternetImage ¶
func FindChange ¶
func FindChange(source interface{}, target interface{}) map[string]interface{}
func GetAllFieldName ¶
func GetDeviceName ¶
Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1 Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Mobile Safari/537.36 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36 Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1
func GetHardwareAddrs ¶
func GetHardwareAddrs() string
func IsFileExist ¶
func RequestByHeader ¶
func RequestByHeader(url string, UserAgent string, Referer string) ([]byte,error) {
client := http.Client{} req, err := http.NewRequest("GET", url, nil) if err != nil { return nil,err } //req.Header.Add("User-Agent","Mozilla/5.0 (Linux; Android 7.0; SLA-AL00 Build/HUAWEISLA-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/57.0.2987.132 MQQBrowser/6.2 TBS/044109 Mobile Safari/537.36 MicroMessenger/6.6.7.1321(0x26060739) NetType/WIFI Language/zh_CN") if !strings.EqualFold(UserAgent, "") { req.Header.Add("User-Agent", UserAgent) } if !strings.EqualFold(Referer, "") { req.Header.Add("Referer", Referer) } resp, err := client.Do(req) if err != nil { return nil,err } defer resp.Body.Close() b, err := ioutil.ReadAll(resp.Body) return b,err
}
func WriteFilePath ¶ added in v1.2.4
func WriteTempFile ¶
func WriteTempUrlNameFile ¶
func WriteWithFile ¶ added in v1.2.11
Types ¶
type FileDirType ¶
type FileDirType int32
var FileDirT FileDirType = 1
var FileDirTemp FileDirType = 1