优化文件结构

This commit is contained in:
boyce
2020-08-01 17:57:34 +08:00
parent c140eb3fa1
commit 396b7e5929
6 changed files with 10 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
package sysmodule package httpclientmodule
import ( import (
"bytes" "bytes"
@@ -13,7 +13,7 @@ import (
"github.com/duanhf2012/origin/service" "github.com/duanhf2012/origin/service"
) )
type HttpClientPoolModule struct { type HttpClientModule struct {
service.Module service.Module
client *http.Client 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) type ProxyFun func(_ *http.Request) (*url.URL, error)
var proxyfun ProxyFun var proxyfun ProxyFun
if proxyUrl != "" { 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{ ret := SyncHttpRespone{
resp: make(chan HttpRespone, 1), resp: make(chan HttpRespone, 1),
} }
@@ -78,7 +78,7 @@ func (slf *HttpClientPoolModule) SyncRequest(method string, url string, body []b
return ret 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 { if slf.client == nil {
panic("Call the init function first") panic("Call the init function first")
} }

View File

@@ -1,4 +1,4 @@
package sysmodule package mysqlmondule
import ( import (
"database/sql" "database/sql"

View File

@@ -1,4 +1,4 @@
package sysmodule package redismodule
import ( import (
"bytes" "bytes"

View File

@@ -1,4 +1,4 @@
package sysservice package httpservice
import ( import (
"fmt" "fmt"

View File

@@ -1,4 +1,4 @@
package sysservice package tcpservice
import ( import (
"fmt" "fmt"

View File

@@ -1,4 +1,4 @@
package sysservice package wsservice
import ( import (
"fmt" "fmt"