小编Man*_*eri的帖子

将日期与 Oracle 中的 current_date 进行比较

我不明白这个查询有什么问题(ORACLE QUERY)

SELECT *
FROM HR.CUSTOMER C
dual
WHERE CREATED_AT = current_date
;
Run Code Online (Sandbox Code Playgroud)

我收到这个错误

ORA-00933: SQL command not properly ended
Run Code Online (Sandbox Code Playgroud)

sql oracle

6
推荐指数
1
解决办法
2万
查看次数

将base64字符串转换为JPG

我将图片dataurl获取为base64字符串(,下面是将转换dataurl为图片的函数,

现在,如果图像为png,则png库将创建图像,而jpg库将引发错误,反之亦然。

问题是当我上传png时效果很好,但是当我上传jpg文件时
返回此错误

无效的JPEG格式:缺少SOI标记

func (ProfileController) SetProfilePic(w http.ResponseWriter, r *http.Request) {

    session, _ := session.UserSession.Get(r, "mvc-user-session")

    var fieldMapForBasic map[string]*json.RawMessage
    var f *os.File

    data, _ := ioutil.ReadAll(r.Body)
    json.Unmarshal(data, &fieldMapForBasic)

    image, _ := json.Marshal(fieldMapForBasic["image"])
    coI := strings.Index(string(image), ",")
    rawImage := string(image)[coI+1:]

    // Encoded Image DataUrl //
    unbased, _ := base64.StdEncoding.DecodeString(string(rawImage))

    res := bytes.NewReader(unbased)
    path, _ := os.Getwd()

    // Path to store the image //
    newpath := filepath.Join(path +  "/storage",  strconv.Itoa(session.Values["id"].(int)))
    os.MkdirAll(newpath, os.ModePerm) …
Run Code Online (Sandbox Code Playgroud)

go

6
推荐指数
2
解决办法
7296
查看次数

golang中强制关闭http连接

我的程序从一台服务器下载一个文件,然后将其返回给用户。这是它的片段:

// Make get request to target server
resp, httpErr := http.Get(url.String()) 

// Return error if http request is failed 
if httpErr != nil {
    fmt.Fprintln(w,"Http Request Failed :" ,httpErr.Error())
    return
}

//Setting up headers
w.Header().Set("Content-Disposition", "attachment; filename="+vid.Title+"."+format.Extension)
w.Header().Set("Content-Type", r.Header.Get("Content-Type"))
w.Header().Set("Content-Length", strconv.Itoa(int(resp.ContentLength)))

// Copy instream of resp.Body to writer
io.Copy(w, resp.Body)
Run Code Online (Sandbox Code Playgroud)

当用户停止下载或关闭连接时,我也想关闭 GET 连接。但正如我通过使用图发现的那样,它并没有关闭。如何关闭用户的连接?

http go

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

go ×2

http ×1

oracle ×1

sql ×1