mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-07 13:00:59 +08:00
feat(hook): Add hook module to help decouple some specific logic (#784)
This commit is contained in:
23
hook/http_client_hook.go
Normal file
23
hook/http_client_hook.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package hook
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type SetHttpClientResult struct {
|
||||
Err error
|
||||
Client *http.Client
|
||||
}
|
||||
|
||||
func (r *SetHttpClientResult) Error() error {
|
||||
if r.Err != nil {
|
||||
log.Printf("⚠️ 执行NewAsterTraderResult时出错: %v", r.Err)
|
||||
}
|
||||
return r.Err
|
||||
}
|
||||
|
||||
func (r *SetHttpClientResult) GetResult() *http.Client {
|
||||
r.Error()
|
||||
return r.Client
|
||||
}
|
||||
Reference in New Issue
Block a user