Documentation ¶
Index ¶
- Constants
- type ITools
- type RetryOption
- type Tools
- func (t *Tools) GetCommonReqInfo(ctx context.Context) (tenantID int64, tenantType int64, namespace string, userID int64)
- func (t *Tools) GetTenantInfo(ctx context.Context) (*cStructs.Tenant, error)
- func (t *Tools) ParseErr(ctx context.Context, err error) *exceptions.BaseError
- func (t *Tools) Retry(f func() error, options *RetryOption) error
- func (t *Tools) SetLaneNameToCtx(ctx context.Context, lane string) context.Context
Constants ¶
View Source
const ( CtxKeyTenantID = "KTenantID" CtxKeyTenantType = "KTenantType" CtxKeyUserID = "KUserID" CtxKeyNamespace = "KNamespace" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ITools ¶
type ITools interface { // Retry 重试工具, 默认一次立即重试 (option is nil) Retry(f func() error, option *RetryOption) error // GetTenantInfo 获取租户信息工具 GetTenantInfo(ctx context.Context) (*cStructs.Tenant, error) // SetLaneNameToCtx 设置泳道环境, 只在调试模式下生效 SetLaneNameToCtx(ctx context.Context, lane string) context.Context // ParseErr 转换 err 为有结构的错误,若 err 非系统返回的,则 code 为 ErrCodeDeveloperError ParseErr(ctx context.Context, err error) *exceptions.BaseError // GetCommonReqInfo 获取通用的请求信息,包括租户id,租户类型,namesapce, userID GetCommonReqInfo(ctx context.Context) (tenantID int64, tenantType int64, namespace string, userID int64) }
type RetryOption ¶
RetryOption 重试选项
func NewRetryOption ¶
func NewRetryOption(retryCount int, retryDelay time.Duration) *RetryOption
type Tools ¶
type Tools struct {
// contains filtered or unexported fields
}
func (*Tools) GetCommonReqInfo ¶
func (*Tools) GetTenantInfo ¶
Click to show internal directories.
Click to hide internal directories.