mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-04 06:54:45 +08:00
优化文件结构
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package sysmodule
|
||||
package httpclientmodule
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"github.com/duanhf2012/origin/service"
|
||||
)
|
||||
|
||||
type HttpClientPoolModule struct {
|
||||
type HttpClientModule struct {
|
||||
service.Module
|
||||
client *http.Client
|
||||
}
|
||||
@@ -43,7 +43,7 @@ func (slf *SyncHttpRespone) Get(timeoutMs int) HttpRespone {
|
||||
}
|
||||
}
|
||||
|
||||
func (slf *HttpClientPoolModule) Init(maxpool int, proxyUrl string) {
|
||||
func (slf *HttpClientModule) Init(maxpool int, proxyUrl string) {
|
||||
type ProxyFun func(_ *http.Request) (*url.URL, error)
|
||||
var proxyfun ProxyFun
|
||||
if proxyUrl != "" {
|
||||
@@ -67,7 +67,7 @@ func (slf *HttpClientPoolModule) Init(maxpool int, proxyUrl string) {
|
||||
}
|
||||
}
|
||||
|
||||
func (slf *HttpClientPoolModule) SyncRequest(method string, url string, body []byte, header http.Header) SyncHttpRespone {
|
||||
func (slf *HttpClientModule) SyncRequest(method string, url string, body []byte, header http.Header) SyncHttpRespone {
|
||||
ret := SyncHttpRespone{
|
||||
resp: make(chan HttpRespone, 1),
|
||||
}
|
||||
@@ -78,7 +78,7 @@ func (slf *HttpClientPoolModule) SyncRequest(method string, url string, body []b
|
||||
return ret
|
||||
}
|
||||
|
||||
func (slf *HttpClientPoolModule) Request(method string, url string, body []byte, header http.Header) HttpRespone {
|
||||
func (slf *HttpClientModule) Request(method string, url string, body []byte, header http.Header) HttpRespone {
|
||||
if slf.client == nil {
|
||||
panic("Call the init function first")
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package sysmodule
|
||||
package mysqlmondule
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
@@ -1,4 +1,4 @@
|
||||
package sysmodule
|
||||
package redismodule
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
Reference in New Issue
Block a user