feat(hook): Add hook module to help decouple some specific logic (#784)

This commit is contained in:
Shui
2025-11-08 20:02:30 -05:00
committed by GitHub
parent 52b0bfe1d2
commit 631fb62d21
12 changed files with 466 additions and 35 deletions

23
hook/http_client_hook.go Normal file
View 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
}