Documentation ¶
Overview ¶
Module for setup AppConfig, ClientConfig
Index ¶
- Variables
- func DefaultAfterFunc(ctx context.Context, resp *http.Response) context.Context
- func DefaultBeforeFunc(ctx context.Context, req *http.Request) context.Context
- func EmptyAfterFunc(ctx context.Context, resp *http.Response) context.Context
- func EmptyBeforeFunc(ctx context.Context, req *http.Request) context.Context
- func InitTransport() http.RoundTripper
- func NewDefaultDecFunc(ctx context.Context, input interface{}, result interface{}) (err error)
- func NewDefaultMakeReqFunc(ctx context.Context, method string, param m.M, c config.Config) (*http.Request, error)
- func SetDefaultDecFunc(f DecFunc)
- func SetDefaultLocation(f Option)
- func SetDefaultLogger(f logger.Logger)
- func SetDefaultMakeReqFunc(f MakeReqFunc)
- func SetDefaultTransport(f http.RoundTripper)
- func WithoutBizContentMakeReqFunc(ctx context.Context, method string, param m.M, c config.Config) (*http.Request, error)
- type DecFunc
- type MakeReqFunc
- type Option
- func AppAuthToken(appAuthToken string) Option
- func AppCertBytes(data []byte) Option
- func AppCertPath(path string) Option
- func AppCertSn(sn string) Option
- func AppId(appId string) Option
- func AppendAfterFunc(f ...ResponseFunc) Option
- func AppendBeforeFunc(f ...ReqFunc) Option
- func AuthToken(authToken string) Option
- func DefaultCharset() Option
- func DefaultFormat() Option
- func DefaultVersion() Option
- func DisableLog() Option
- func NewDefaultLocation() Option
- func NotifyUrl(notifyUrl string) Option
- func PrivateKey(privateKey string) Option
- func PrivateKeyType(privateKeyType string) Option
- func Production(input bool) Option
- func PublicCertBytes(data []byte) Option
- func PublicCertPath(path string) Option
- func PublicCertSn(sn string) Option
- func ReturnUrl(returnUrl string) Option
- func RootCertBytes(data []byte) Option
- func RootCertPath(path string) Option
- func RootCertSn(sn string) Option
- func SetAfterFunc(f ...ResponseFunc) Option
- func SetBeforeFunc(f ...ReqFunc) Option
- func SetLocation(loc *time.Location) Option
- func SetLogger(Logger logger.Logger) Option
- func SetMakeReqFunc(f MakeReqFunc) Option
- func SignType(signType string) Option
- func Transport(transport http.RoundTripper) Option
- type Options
- type ReqFunc
- type ResponseFunc
Constants ¶
This section is empty.
Variables ¶
var ( DefaultTransport = InitTransport() DefaultMakeReqFunc MakeReqFunc = NewDefaultMakeReqFunc DefaultDecFunc DecFunc = NewDefaultDecFunc DefaultLocation = NewDefaultLocation() DefaultLogger logger.Logger = logger.StdLogger )
Functions ¶
func DefaultAfterFunc ¶
DefaultAfterFunc log the response body
func DefaultBeforeFunc ¶
DefaultBeforeFunc log the request body
func EmptyAfterFunc ¶
EmptyAfterFunc do nothing
func EmptyBeforeFunc ¶
EmptyBeforeFunc do nothing
func InitTransport ¶ added in v0.2.2
func InitTransport() http.RoundTripper
func NewDefaultDecFunc ¶
NewDefaultDecFunc encode json into target struct
func NewDefaultMakeReqFunc ¶
func NewDefaultMakeReqFunc(ctx context.Context, method string, param m.M, c config.Config) (*http.Request, error)
NewDefaultMakeReqFunc default make request func
func SetDefaultDecFunc ¶
func SetDefaultDecFunc(f DecFunc)
SetDefaultDecFunc Set Global Default DecFunc
func SetDefaultLocation ¶
func SetDefaultLocation(f Option)
SetDefaultLocation Set Global Default Location
func SetDefaultLogger ¶
SetDefaultLogger Set Global Default Logger
func SetDefaultMakeReqFunc ¶
func SetDefaultMakeReqFunc(f MakeReqFunc)
SetDefaultMakeReqFunc Set Global Default MakeReqFunc
func SetDefaultTransport ¶
func SetDefaultTransport(f http.RoundTripper)
SetDefaultTransport Set Global Default Transport
Types ¶
type MakeReqFunc ¶
type MakeReqFunc func(context context.Context, method string, m m.M, config config.Config) (*http.Request, error)
MakeReqFunc make request
type Option ¶
type Option func(*Options)
func AppendAfterFunc ¶
func AppendAfterFunc(f ...ResponseFunc) Option
AppendAfterFunc append a ResponseFunc after current list
func AppendBeforeFunc ¶
AppendBeforeFunc append a ReqFunc after current list
func NewDefaultLocation ¶
func NewDefaultLocation() Option
NewDefaultLocation set location as Asia/Shanghai
func PrivateKeyType ¶
PrivateKey set PrivateKeyType
func PublicCertBytes ¶
PublicCertBytes set PublicCertSn from bytes
func PublicCertPath ¶
PublicCertPath set PublicCertSn from path
func SetMakeReqFunc ¶ added in v0.1.3
func SetMakeReqFunc(f MakeReqFunc) Option
SetMakeReqFunc set MakeRequestFunc
type Options ¶
type Options struct { Config config.Config // hooks Before []ReqFunc After []ResponseFunc Dec DecFunc MakeReq MakeReqFunc // other custom options // can be stored in a context Context context.Context Transport http.RoundTripper Logger logger.Logger }
Options for alipay sdk
func DefaultOptions ¶
DefaultOptions set DefaultAfterFunc, DefaultBeforeFunc, DefaultLogger