Documentation
¶
Index ¶
Constants ¶
View Source
const ( ContextKeyAppId = "hd-app-id" // 应用ID ContextKeyClient = "hd-client" // 客户端 ContextKeyRelease = "hd-release" // 版本号 ContextKeyTsn = "hd-tsn" // tenant sn ContextKeyTid = "hd-tid" // tenant id ContextKeyUid = "hd-uid" // user id ContextKeyUsn = "hd-usn" // user sn ContextKeyRoleIds = "hd-role-ids" // role ids ContextKeyCaller = "dapr-caller-app-id" ContextKeyDbTransaction = "hd-db-tx" )
View Source
const (
ErrCodeInternal // internal error
)
define utils error code
View Source
const (
ErrCodeModuleRoot = ErrCodeStart * (1 + iota)
)
ErrCodeModuleRoot define error code module, e,g: 10000, 20000, 30000...
View Source
const ErrCodeStart = 10000
ErrCodeStart 业务逻辑错误代码开始值
Variables ¶
This section is empty.
Functions ¶
func NewOutgoingGrpcContext ¶
func ToGrpcError ¶
Types ¶
type Context ¶
type Context interface {
WithValue(kvs ...any) Context // 添加键值
WithTid(tid int64) Context // 快捷函数设置tid
WithTx(tx any) Context // 快捷函数设置tx
Value(key any) (any, bool) // 获取键值
MD() map[string][]string // 转换成GRPC metadata类型
Tid() int64 // 获取租户ID
Uid() int64 // 获取用户ID
Usn() string // 获取用户SN
AppId() string // 获取应用ID
RoleIds() []int64 // 获取角色ID列表
}
func NewContext ¶
type Error ¶
func InternalError ¶
Click to show internal directories.
Click to hide internal directories.