feat: add tenant commands

This commit is contained in:
Rogee
2024-12-07 18:48:05 +08:00
parent e15d8d9bb2
commit 8f88929575
25 changed files with 271 additions and 48 deletions

View File

@@ -18,8 +18,8 @@ const (
CtxKeyTx CtxKey = "__ctx_db:"
// CtxKeyJwt is a CtxKey of type Jwt.
CtxKeyJwt CtxKey = "__jwt_token:"
// CtxKeySession is a CtxKey of type Session.
CtxKeySession CtxKey = "__session_user:"
// CtxKeyClaim is a CtxKey of type Claim.
CtxKeyClaim CtxKey = "__jwt_claim:"
)
var ErrInvalidCtxKey = fmt.Errorf("not a valid CtxKey, try [%s]", strings.Join(_CtxKeyNames, ", "))
@@ -27,7 +27,7 @@ var ErrInvalidCtxKey = fmt.Errorf("not a valid CtxKey, try [%s]", strings.Join(_
var _CtxKeyNames = []string{
string(CtxKeyTx),
string(CtxKeyJwt),
string(CtxKeySession),
string(CtxKeyClaim),
}
// CtxKeyNames returns a list of possible string values of CtxKey.
@@ -42,7 +42,7 @@ func CtxKeyValues() []CtxKey {
return []CtxKey{
CtxKeyTx,
CtxKeyJwt,
CtxKeySession,
CtxKeyClaim,
}
}
@@ -59,9 +59,9 @@ func (x CtxKey) IsValid() bool {
}
var _CtxKeyValue = map[string]CtxKey{
"__ctx_db:": CtxKeyTx,
"__jwt_token:": CtxKeyJwt,
"__session_user:": CtxKeySession,
"__ctx_db:": CtxKeyTx,
"__jwt_token:": CtxKeyJwt,
"__jwt_claim:": CtxKeyClaim,
}
// ParseCtxKey attempts to convert a string to a CtxKey.

View File

@@ -4,6 +4,6 @@ package consts
// ENUM(
// Tx = "__ctx_db:",
// Jwt = "__jwt_token:",
// Session = "__session_user:",
// Claim = "__jwt_claim:",
// )
type CtxKey string