Golang通过ssh连接数据库

Mysql Postgresql

February 23, 2022 · 1 min · czyt

golang不创建临时文件上传网络文件

func UploadFromUrl(uploadUrl string, resUrl string,postFileName string, submitField string) error { method := "POST" payload := &bytes.Buffer{} writer := multipart.NewWriter(payload) if res, err := http.Get(resUrl); err != nil { return err } else { defer func() { if res != nil { _ = res.Body.Close() } }() part, _ := writer.CreateFormFile(submitField, postFileName) if _, copyErr := io.Copy(part, res.Body); copyErr != nil { return copyErr } if err := writer.Close(); err != nil { return err } } client := &http....

May 21, 2021 · 1 min · czyt