✨ feat(vscode): 代码阅读加枚举卡片,Python enum 库规则和 TypeScript enum 画成同一张表
This commit is contained in:
1 parent
2251e67ef8
commit
de355661f0
24 files changed
+858
-83
No files matched your search
@@ -0,0 +1,38 @@
|
||||
# luffy-agent-platform 的 backend/src/luffy_agent/referral/models.py、vault/models.py 节选:enum 库规则的样例
|
||||
from __future__ import annotations
|
||||
|
||||
import enum
|
||||
|
||||
from sqlalchemy import Enum as SQLEnum
|
||||
|
||||
|
||||
class ReferralStatus(str, enum.Enum):
|
||||
NORMAL = "normal"
|
||||
FROZEN = "frozen"
|
||||
|
||||
|
||||
class RelationStatus(str, enum.Enum):
|
||||
ACTIVE = "active"
|
||||
INVALID = "invalid"
|
||||
|
||||
|
||||
class CommissionStatus(str, enum.Enum):
|
||||
PENDING = "pending" # 待结算
|
||||
AVAILABLE = "available" # 可提现
|
||||
WITHDRAWING = "withdrawing" # 提现中
|
||||
WITHDRAWN = "withdrawn" # 已提现
|
||||
INVALID = "invalid" # 已失效
|
||||
|
||||
|
||||
class SecretScope(enum.StrEnum):
|
||||
"""条目作用域: user 全局 / app 级 (同名覆盖 user)."""
|
||||
|
||||
USER = "user"
|
||||
APP = "app"
|
||||
|
||||
|
||||
class SecretKind(enum.StrEnum):
|
||||
"""条目类型: secret 只写不读; variable 可读回明文."""
|
||||
|
||||
SECRET = "secret"
|
||||
VARIABLE = "variable"
|
||||
@@ -0,0 +1,20 @@
|
||||
/** 订单状态。 */
|
||||
export enum OrderStatus {
|
||||
/** 待支付 */
|
||||
Pending = 'pending',
|
||||
Paid = 'paid', // 已支付
|
||||
// 已取消
|
||||
Cancelled = 'cancelled',
|
||||
}
|
||||
|
||||
enum Direction { Up, Down = 5, Left, Right = -1, Next, Mask = 1 << 2, After }
|
||||
|
||||
export const enum Flag { A = 0x10, B }
|
||||
|
||||
declare enum Ambient { X }
|
||||
|
||||
export declare const enum Both { Y = 1 }
|
||||
|
||||
function local(): void {
|
||||
enum Inner { Z }
|
||||
}
|
||||
Reference in new issue
Block a user