做一次小小的备份,等会又删掉了
This commit is contained in:
@@ -37,20 +37,43 @@
|
||||
- [ ] All HTTP operations use Fiber framework
|
||||
- [ ] All database operations use GORM
|
||||
- [ ] All async tasks use Asynq
|
||||
- [ ] Uses Go official toolchain: `go fmt`, `go vet`, `golangci-lint`
|
||||
- [ ] Uses Go Modules for dependency management
|
||||
|
||||
**Code Quality Standards**:
|
||||
- [ ] Follows Handler → Service → Store → Model architecture
|
||||
- [ ] Handler layer only handles HTTP, no business logic
|
||||
- [ ] Service layer contains business logic with cross-module support
|
||||
- [ ] Store layer manages all data access with transaction support
|
||||
- [ ] Uses dependency injection via Service/Store structs
|
||||
- [ ] Uses dependency injection via struct fields (not constructor patterns)
|
||||
- [ ] Unified error codes in `pkg/errors/`
|
||||
- [ ] Unified API responses via `pkg/response/`
|
||||
- [ ] All constants defined in `pkg/constants/`
|
||||
- [ ] All Redis keys managed via key generation functions (no hardcoded strings)
|
||||
- [ ] All exported functions/types have Go-style doc comments
|
||||
- [ ] Code formatted with `gofmt`
|
||||
- [ ] Follows Effective Go and Go Code Review Comments
|
||||
|
||||
**Go Idiomatic Design**:
|
||||
- [ ] Package structure is flat (max 2-3 levels), organized by feature
|
||||
- [ ] Interfaces are small (1-3 methods), defined at use site
|
||||
- [ ] No Java-style patterns: no I-prefix, no Impl-suffix, no getters/setters
|
||||
- [ ] Error handling is explicit (return errors, no panic/recover abuse)
|
||||
- [ ] Uses composition over inheritance
|
||||
- [ ] Uses goroutines and channels (not thread pools)
|
||||
- [ ] Uses `context.Context` for cancellation and timeouts
|
||||
- [ ] Naming follows Go conventions: short receivers, consistent abbreviations (URL, ID, HTTP)
|
||||
- [ ] No Hungarian notation or type prefixes
|
||||
- [ ] Simple constructors (New/NewXxx), no Builder pattern unless necessary
|
||||
|
||||
**Testing Standards**:
|
||||
- [ ] Unit tests for all core business logic (Service layer)
|
||||
- [ ] Integration tests for all API endpoints
|
||||
- [ ] Tests use Go standard testing framework
|
||||
- [ ] Test files named `*_test.go` in same directory
|
||||
- [ ] Test functions use `Test` prefix, benchmarks use `Benchmark` prefix
|
||||
- [ ] Table-driven tests for multiple test cases
|
||||
- [ ] Test helpers marked with `t.Helper()`
|
||||
- [ ] Tests are independent (no external service dependencies)
|
||||
- [ ] Target coverage: 70%+ overall, 90%+ for core business
|
||||
|
||||
@@ -69,6 +92,9 @@
|
||||
- [ ] List queries implement pagination (default 20, max 100)
|
||||
- [ ] Non-realtime operations use async tasks
|
||||
- [ ] Database and Redis connection pools properly configured
|
||||
- [ ] Uses goroutines/channels for concurrency (not thread pools)
|
||||
- [ ] Uses `context.Context` for timeout control
|
||||
- [ ] Uses `sync.Pool` for frequently allocated objects
|
||||
|
||||
## Project Structure
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ description: "Task list template for feature implementation"
|
||||
- [ ] T003 [P] Configure linting (golangci-lint) and formatting tools (gofmt/goimports)
|
||||
- [ ] T004 [P] Setup unified error codes in pkg/errors/
|
||||
- [ ] T005 [P] Setup unified API response in pkg/response/
|
||||
- [ ] T006 [P] Setup constants management in pkg/constants/ (business constants and Redis key functions)
|
||||
|
||||
---
|
||||
|
||||
@@ -64,18 +65,18 @@ description: "Task list template for feature implementation"
|
||||
|
||||
Foundational tasks for 君鸿卡管系统 tech stack:
|
||||
|
||||
- [ ] T006 Setup PostgreSQL database connection via GORM with connection pool (MaxOpenConns=25, MaxIdleConns=10)
|
||||
- [ ] T007 Setup Redis connection with connection pool (PoolSize=10, MinIdleConns=5)
|
||||
- [ ] T008 [P] Setup database migrations framework (golang-migrate or GORM AutoMigrate)
|
||||
- [ ] T009 [P] Implement Fiber routing structure in internal/router/
|
||||
- [ ] T010 [P] Implement Fiber middleware (authentication, logging, recovery, validation) in internal/handler/middleware/
|
||||
- [ ] T011 [P] Setup Zap logger with Lumberjack rotation in pkg/logger/
|
||||
- [ ] T012 [P] Setup Viper configuration management in pkg/config/
|
||||
- [ ] T013 [P] Setup Asynq task queue client and server in pkg/queue/
|
||||
- [ ] T014 [P] Setup Validator integration in pkg/validator/
|
||||
- [ ] T015 Create base Store structure with transaction support in internal/store/
|
||||
- [ ] T016 Create base Service structure with dependency injection in internal/service/
|
||||
- [ ] T017 Setup sonic JSON as default serializer for Fiber
|
||||
- [ ] T007 Setup PostgreSQL database connection via GORM with connection pool (MaxOpenConns=25, MaxIdleConns=10)
|
||||
- [ ] T008 Setup Redis connection with connection pool (PoolSize=10, MinIdleConns=5)
|
||||
- [ ] T009 [P] Setup database migrations framework (golang-migrate or GORM AutoMigrate)
|
||||
- [ ] T010 [P] Implement Fiber routing structure in internal/router/
|
||||
- [ ] T011 [P] Implement Fiber middleware (authentication, logging, recovery, validation) in internal/handler/middleware/
|
||||
- [ ] T012 [P] Setup Zap logger with Lumberjack rotation in pkg/logger/
|
||||
- [ ] T013 [P] Setup Viper configuration management in pkg/config/
|
||||
- [ ] T014 [P] Setup Asynq task queue client and server in pkg/queue/
|
||||
- [ ] T015 [P] Setup Validator integration in pkg/validator/
|
||||
- [ ] T016 Create base Store structure with transaction support in internal/store/
|
||||
- [ ] T017 Create base Service structure with dependency injection in internal/service/
|
||||
- [ ] T018 Setup sonic JSON as default serializer for Fiber
|
||||
|
||||
**Checkpoint**: Foundation ready - user story implementation can now begin in parallel
|
||||
|
||||
@@ -179,6 +180,11 @@ Foundational tasks for 君鸿卡管系统 tech stack:
|
||||
- [ ] TXXX Quality Gate: Check no TODO/FIXME remains (or documented in issues)
|
||||
- [ ] TXXX Quality Gate: Verify database migrations work correctly
|
||||
- [ ] TXXX Quality Gate: Verify API documentation updated (if API changes)
|
||||
- [ ] TXXX Quality Gate: Verify no hardcoded constants or Redis keys (all use pkg/constants/)
|
||||
- [ ] TXXX Quality Gate: Verify no Java-style anti-patterns (no getter/setter, no I-prefix, no Impl-suffix)
|
||||
- [ ] TXXX Quality Gate: Verify Go naming conventions (UserID not userId, HTTPServer not HttpServer)
|
||||
- [ ] TXXX Quality Gate: Verify error handling is explicit (no panic/recover abuse)
|
||||
- [ ] TXXX Quality Gate: Verify uses goroutines/channels (not thread pool patterns)
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user