docs(zh-CN): translate code block(plain text) (#753)

Co-authored-by: neo <neo.dowithless@gmail.com>
This commit is contained in:
zdoc.app
2026-03-23 06:39:24 +08:00
committed by GitHub
parent fd2a8edb53
commit 4f6f587700
118 changed files with 1807 additions and 1835 deletions

View File

@@ -43,11 +43,11 @@
```
src/
|-- app/ # Next.js app router
|-- components/ # Reusable UI components
|-- hooks/ # Custom React hooks
|-- lib/ # Utility libraries
|-- types/ # TypeScript definitions
|-- app/ # Next.js 应用路由
|-- components/ # 可复用的 UI 组件
|-- hooks/ # 自定义 React 钩子
|-- lib/ # 工具库
|-- types/ # TypeScript 定义
```
## 关键模式

View File

@@ -97,38 +97,38 @@ class InsufficientStockError(APIException):
```
config/
settings/
base.py # Shared settings
local.py # Dev overrides (DEBUG=True)
production.py # Production settings
urls.py # Root URL config
celery.py # Celery app configuration
base.py # 共享设置
local.py # 开发环境覆盖设置 (DEBUG=True)
production.py # 生产环境设置
urls.py # URL 配置
celery.py # Celery 应用配置
apps/
accounts/ # User auth, registration, profile
accounts/ # 用户认证、注册、个人资料
models.py
serializers.py
views.py
services.py # Business logic
services.py # 业务逻辑
tests/
test_views.py
test_services.py
factories.py # Factory Boy factories
orders/ # Order management
factories.py # Factory Boy 工厂
orders/ # 订单管理
models.py
serializers.py
views.py
services.py
tasks.py # Celery tasks
tasks.py # Celery 任务
tests/
products/ # Product catalog
products/ # 产品目录
models.py
serializers.py
views.py
tests/
core/
exceptions.py # Custom API exceptions
permissions.py # Shared permission classes
pagination.py # Custom pagination
middleware.py # Request logging, timing
exceptions.py # 自定义 API 异常
permissions.py # 共享权限类
pagination.py # 自定义分页
middleware.py # 请求日志记录、计时
tests/
```

View File

@@ -66,31 +66,31 @@ func toGRPCError(err error) error {
```
cmd/
server/
main.go # Entrypoint, Wire injection, graceful shutdown
main.go # 入口点Wire注入优雅关闭
internal/
domain/ # Business types and interfaces
user.go # User entity and repository interface
errors.go # Sentinel errors
service/ # Business logic
domain/ # 业务类型和接口
user.go # 用户实体和仓库接口
errors.go # 哨兵错误
service/ # 业务逻辑
user_service.go
user_service_test.go
repository/ # Data access (sqlc-generated + custom)
repository/ # 数据访问sqlc生成 + 自定义)
postgres/
user_repo.go
user_repo_test.go # Integration tests with testcontainers
handler/ # gRPC + REST handlers
user_repo_test.go # 使用testcontainers的集成测试
handler/ # gRPC + REST处理程序
grpc/
user_handler.go
rest/
user_handler.go
config/ # Configuration loading
config/ # 配置加载
config.go
proto/ # Protobuf definitions
proto/ # Protobuf定义
user/v1/
user.proto
queries/ # SQL queries for sqlc
queries/ # sqlc的SQL查询
user.sql
migrations/ # Database migrations
migrations/ # 数据库迁移
001_create_users.up.sql
001_create_users.down.sql
```

View File

@@ -92,36 +92,36 @@ impl IntoResponse for AppError {
```
src/
main.rs # Entrypoint, server setup, graceful shutdown
lib.rs # Re-exports for integration tests
config.rs # Environment config with envy or figment
router.rs # Axum router with all routes
main.rs # 入口点、服务器设置、优雅关闭
lib.rs # 用于集成测试的重新导出
config.rs # 使用 envy figment 的环境配置
router.rs # 包含所有路由的 Axum 路由器
middleware/
auth.rs # JWT extraction and validation
logging.rs # Request/response tracing
auth.rs # JWT 提取与验证
logging.rs # 请求/响应追踪
handlers/
mod.rs # Route handlers (thin — delegate to services)
mod.rs # 路由处理器(精简版——委托给服务层)
users.rs
orders.rs
services/
mod.rs # Business logic
mod.rs # 业务逻辑
users.rs
orders.rs
repositories/
mod.rs # Database access (SQLx queries)
mod.rs # 数据库访问SQLx 查询)
users.rs
orders.rs
domain/
mod.rs # Domain types, error enums
mod.rs # 领域类型、错误枚举
user.rs
order.rs
migrations/
001_create_users.sql
002_create_orders.sql
tests/
common/mod.rs # Shared test helpers, test server setup
api_users.rs # Integration tests for user endpoints
api_orders.rs # Integration tests for order endpoints
common/mod.rs # 共享测试辅助工具、测试服务器设置
api_users.rs # 用户端点的集成测试
api_orders.rs # 订单端点的集成测试
```
## 关键模式

View File

@@ -45,24 +45,24 @@
```
src/
app/
(auth)/ # Auth pages (login, signup, forgot-password)
(dashboard)/ # Protected dashboard pages
(auth)/ # 认证页面(登录、注册、忘记密码)
(dashboard)/ # 受保护的仪表板页面
api/
webhooks/ # Stripe, Supabase webhooks
layout.tsx # Root layout with providers
webhooks/ # StripeSupabase webhooks
layout.tsx # 根布局(包含 providers
components/
ui/ # Shadcn/ui components
forms/ # Form components with validation
dashboard/ # Dashboard-specific components
hooks/ # Custom React hooks
ui/ # Shadcn/ui 组件
forms/ # 带验证的表单组件
dashboard/ # 仪表板专用组件
hooks/ # 自定义 React hooks
lib/
supabase/ # Supabase client factories
stripe/ # Stripe client and helpers
utils.ts # General utilities
types/ # Shared TypeScript types
supabase/ # Supabase 客户端工厂
stripe/ # Stripe 客户端与辅助工具
utils.ts # 通用工具函数
types/ # 共享 TypeScript 类型
supabase/
migrations/ # Database migrations
seed.sql # Development seed data
migrations/ # 数据库迁移
seed.sql # 开发用种子数据
```
## 关键模式