做一次小小的备份,等会又删掉了

This commit is contained in:
2025-11-11 10:09:45 +08:00
parent 37c4404293
commit 9600e5b6e0
35 changed files with 4564 additions and 56 deletions

View File

@@ -104,12 +104,26 @@
- [ ] All async tasks use Asynq
- [ ] All logging uses Zap + Lumberjack.v2
- [ ] All configuration uses Viper
- [ ] Uses Go official toolchain: `go fmt`, `go vet`, `golangci-lint`
**Architecture Requirements**:
- [ ] Implementation follows Handler → Service → Store → Model layers
- [ ] Dependencies injected via Service/Store structs
- [ ] Dependencies injected via struct fields (not constructor patterns)
- [ ] Unified error codes defined in `pkg/errors/`
- [ ] Unified API responses via `pkg/response/`
- [ ] All constants defined in `pkg/constants/` (no magic numbers/strings)
- [ ] All Redis keys managed via `pkg/constants/` key generation functions
- [ ] Package structure is flat, organized by feature (not by layer)
**Go Idiomatic Design Requirements**:
- [ ] No Java-style patterns: no getter/setter methods, no I-prefix interfaces, no Impl-suffix
- [ ] Interfaces are small (1-3 methods), defined where used
- [ ] Error handling is explicit (return errors, not panic)
- [ ] Uses composition (struct embedding) not inheritance
- [ ] Uses goroutines and channels for concurrency
- [ ] Naming follows Go conventions: `UserID` not `userId`, `HTTPServer` not `HttpServer`
- [ ] No Hungarian notation or type prefixes
- [ ] Simple and direct code structure
**API Design Requirements**:
- [ ] All APIs follow RESTful principles
@@ -125,10 +139,13 @@
- [ ] Batch operations use bulk queries
- [ ] List queries implement pagination (default 20, max 100)
- [ ] Non-realtime operations delegated to async tasks
- [ ] Uses `context.Context` for timeouts and cancellation
**Testing Requirements**:
- [ ] Unit tests for all Service layer business logic
- [ ] Integration tests for all API endpoints
- [ ] Tests use Go standard testing framework with `*_test.go` files
- [ ] Table-driven tests for multiple test cases
- [ ] Tests are independent and use mocks/testcontainers
- [ ] Target coverage: 70%+ overall, 90%+ for core business logic