core

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package core 包含SDKClient

Index

Constants

View Source
const (
	// BASE_URL 默认APIgateway
	BASE_URL = "https://openapi.meituan.com/api/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Otel

type Otel struct {
	// contains filtered or unexported fields
}

func NewOtel

func NewOtel(namespace string, appKey string) *Otel

func (*Otel) WithSpan

func (o *Otel) WithSpan(ctx context.Context, req *http.Request, resp model.Response, payload []byte, fn func(*http.Request, model.Response) (*http.Response, error)) error

type RateLimiter

type RateLimiter interface {
	Take() time.Duration
}

type SDKClient

type SDKClient struct {
	// contains filtered or unexported fields
}

SDKClient sdk client

func NewSDKClient

func NewSDKClient(appKey string, secret string) *SDKClient

NewSDKClient 创建SDKClient

func (*SDKClient) Copy

func (c *SDKClient) Copy() *SDKClient

Copy 复制SDKClient

func (*SDKClient) Get

func (c *SDKClient) Get(ctx context.Context, gw string, req model.GetRequest, resp model.Response) error

Get get api

func (*SDKClient) SetDebug

func (c *SDKClient) SetDebug(debug bool)

SetDebug 设置debug模式

func (*SDKClient) SetHttpClient

func (c *SDKClient) SetHttpClient(client *http.Client)

SetHttpClient 设置http.Client

func (*SDKClient) SetRateLimiter

func (c *SDKClient) SetRateLimiter(limiter RateLimiter)

SetRateLimiter 设置限流

func (*SDKClient) WithSpan

func (c *SDKClient) WithSpan(ctx context.Context, req *http.Request, resp model.Response, payload []byte, fn func(*http.Request, model.Response) (*http.Response, error)) error

func (*SDKClient) WithTracer

func (c *SDKClient) WithTracer(namespace string)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL