!134 feat: 新增支持es和连接池

* feat: 各连接,支持连接池
* feat:支持es
This commit is contained in:
zongyangleo
2025-05-21 04:42:30 +00:00
committed by Coder慌
parent f676ec9e7b
commit 142bbd265d
89 changed files with 5734 additions and 575 deletions

View File

@@ -54,8 +54,8 @@ func (r *Req) Header(name, value string) *Req {
return r
}
func (r *Req) Timeout(timeout int) *Req {
r.timeout = timeout
func (r *Req) Timeout(second int) *Req {
r.timeout = second
return r
}
@@ -107,6 +107,25 @@ func (r *Req) PostForm(params string) *Resp {
return sendRequest(r)
}
func (r *Req) PutJson(body string) *Resp {
buf := bytes.NewBufferString(body)
r.method = "PUT"
r.body = buf
if r.header == nil {
r.header = make(map[string]string)
}
r.header["Content-type"] = "application/json"
return sendRequest(r)
}
func (r *Req) PutObj(body any) *Resp {
marshal, err := json.Marshal(body)
if err != nil {
return &Resp{err: errors.New("解析json obj错误")}
}
return r.PutJson(string(marshal))
}
func (r *Req) PostMulipart(files []MultipartFile, reqParams collx.M) *Resp {
buf := &bytes.Buffer{}
// 文件写入 buf