instance.go 278 B

123456789101112131415161718192021
  1. package http_client
  2. var clientInstance *Client
  3. func InitInstance() {
  4. if clientInstance == nil {
  5. clientInstance = New()
  6. }
  7. }
  8. func DestroyInstance() {
  9. if clientInstance == nil {
  10. return
  11. }
  12. Destroy(clientInstance)
  13. }
  14. func GetInstance() *Client {
  15. return clientInstance
  16. }