core

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "1.0.10" // SDK版本号

Variables

This section is empty.

Functions

func RequestID

func RequestID(ctx context.Context) string

RequestID 获取requestID

func WithRequestID

func WithRequestID(parent context.Context, requestID string) context.Context

WithRequestID 注入requestID

Types

type Core

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

Core client 用以实现 Invoker

func New

func New(option ...Option) (*Core, error)

New 新建 Core

func (*Core) Invoke

func (o *Core) Invoke(ctx context.Context, method string, urlStr string, respEncrypted bool, req interface{}, resp interface{}) error

Invoke 实现invoker接口

func (*Core) IsSetSigner added in v1.0.9

func (o *Core) IsSetSigner() bool

IsSetSigner 是否设置signer

type Handler

type Handler func(ctx context.Context, req interface{}) (resp interface{}, err error)

Handler 中间件使用 Handler

type Logger

type Logger interface {
	Logf(ctx context.Context, format string, args ...interface{})
}

Logger 日志接口

type Middleware

type Middleware func(Handler) Handler

Middleware 中间件

func Chain

func Chain(m ...Middleware) Middleware

Chain 中间件链

type Option

type Option func(*Core)

Option 配置

func EnDebug

func EnDebug() Option

EnDebug 开启debug模式

func WithDealerID

func WithDealerID(dealerID string) Option

WithDealerID 设置dealerID

func WithDes3Encoding

func WithDes3Encoding(des3Key string) Option

WithDes3Encoding 加解密

func WithHmacSign

func WithHmacSign(appKey string) Option

WithHmacSign HMAC 签名

func WithHost

func WithHost(host string) Option

WithHost 设置访问地址

func WithHttpClient

func WithHttpClient(client *http.Client) Option

WithHttpClient http client

func WithLogger

func WithLogger(logger Logger) Option

WithLogger 日志

func WithMiddleware

func WithMiddleware(m ...Middleware) Option

WithMiddleware 中间件

func WithRsaSign

func WithRsaSign(privateKey, appKey string) Option

WithRsaSign RSA 签名

Jump to

Keyboard shortcuts

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