juhe

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogTable = "juhe"
)
View Source
const (
	Version = "1.0.2"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client 实例

func NewClient

func NewClient() (*Client, error)

NewClient 创建实例化

func (*Client) MobileGet

func (c *Client) MobileGet(ctx context.Context, phone string, key string, notMustParams ...gorequest.Params) (*MobileGetResult, error)

MobileGet 手机号码归属地 https://www.juhe.cn/docs/api/id/11

func (*Client) SetClientIP

func (c *Client) SetClientIP(clientIP string) *Client

SetClientIP 配置

func (*Client) SetLogFun

func (c *Client) SetLogFun(logFun gorequest.LogFunc)

SetLogFun 设置日志记录函数

func (*Client) SetTrace

func (c *Client) SetTrace(trace bool)

SetTrace 设置OpenTelemetry链路追踪

func (*Client) TraceEndSpan

func (c *Client) TraceEndSpan()

TraceEndSpan 结束OpenTelemetry链路追踪状态

func (*Client) TraceGetSpanID

func (c *Client) TraceGetSpanID() (spanID string)

TraceGetSpanID 获取OpenTelemetry链路追踪SpanID

func (*Client) TraceGetTraceID

func (c *Client) TraceGetTraceID() (traceID string)

TraceGetTraceID 获取OpenTelemetry链路追踪TraceID

func (*Client) TraceRecordError

func (c *Client) TraceRecordError(err error, options ...trace.EventOption)

TraceRecordError 记录OpenTelemetry链路追踪错误

func (*Client) TraceSetAttributes

func (c *Client) TraceSetAttributes(kv ...attribute.KeyValue)

TraceSetAttributes 设置OpenTelemetry链路追踪属性

func (*Client) TraceSetStatus

func (c *Client) TraceSetStatus(code codes.Code, description string)

TraceSetStatus 设置OpenTelemetry链路追踪状态

func (*Client) TraceStartSpan

func (c *Client) TraceStartSpan(ctx context.Context, spanName string) context.Context

TraceStartSpan 开始OpenTelemetry链路追踪状态

type ClientConfig

type ClientConfig struct {
}

ClientConfig 实例配置

type MobileGetResponse

type MobileGetResponse struct {
	Resultcode string `json:"resultcode"` // 返回码
	Reason     string `json:"reason"`     // 返回说明
	Result     struct {
		Province string `json:"province"` // 省份
		City     string `json:"city"`     // 城市,(部分记录可能为空)
		Areacode string `json:"areacode"` // 区号,(部分记录可能为空)
		Zip      string `json:"zip"`      // 邮编,(部分记录可能为空)
		Company  string `json:"company"`  // 运营商
		Card     string `json:"card,omitempty"`
	} `json:"result"` // 返回结果集
}

type MobileGetResult

type MobileGetResult struct {
	Result MobileGetResponse  // 结果
	Body   []byte             // 内容
	Http   gorequest.Response // 请求
}

Jump to

Keyboard shortcuts

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