ai:prompt:review-pr-golang
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| ai:prompt:review-pr-golang [2026/06/11 14:08] – phong2018 | ai:prompt:review-pr-golang [2026/06/11 14:20] (current) – phong2018 | ||
|---|---|---|---|
| Line 15: | Line 15: | ||
| ``` | ``` | ||
| Presentation (HTTP handler) | Presentation (HTTP handler) | ||
| - | ↓ calls via ITodoUsecase | + | ↓ calls via TodoUsecase |
| Usecase | Usecase | ||
| ↓ imports domain only | ↓ imports domain only | ||
| Domain | Domain | ||
| model/ | model/ | ||
| - | repository/ | + | repository/ |
| - | service/ | + | service/ |
| - | | + | |
| ↑ implemented by | ↑ implemented by | ||
| Infrastructure | Infrastructure | ||
| Line 49: | Line 49: | ||
| | Interface | Lives in | Reason | | | Interface | Lives in | Reason | | ||
| |-----------|----------|--------| | |-----------|----------|--------| | ||
| - | | `ITodoRepository` | `domain/ | + | | `TodoRepository` | `domain/ |
| - | | `INotificationClient` | `domain/ | + | | `NotificationClient` | `domain/ |
| - | | `IFileStorage` | `domain/ | + | | `FileStorage` | `domain/ |
| - | | `ITodoUsecase` | `usecase/` | presentation consumes it — uses `usecase/ | + | | `TodoUsecase` | `usecase/` | presentation consumes it — uses `usecase/ |
| - | | `ITransaction` | `usecase/` | transaction boundary is application orchestration, | + | | `Transaction` | `usecase/` | transaction boundary is application orchestration, |
| - | Flag `ITodoUsecase` placed in `domain/` — it would force domain to import `usecase/ | + | Flag `TodoUsecase` placed in `domain/` — it would force domain to import `usecase/ |
| ### DTO placement rules | ### DTO placement rules | ||
| Line 76: | Line 76: | ||
| → usecase/ | → usecase/ | ||
| → map (usecase impl) → domain/ | → map (usecase impl) → domain/ | ||
| - | → ITodoRepository.Create(ctx, | + | → TodoRepository.Create(ctx, |
| → map (usecase impl) → usecase/ | → map (usecase impl) → usecase/ | ||
| → JSON response | → JSON response | ||
| Line 101: | Line 101: | ||
| - [ ] Domain sentinel errors live in `domain/ | - [ ] Domain sentinel errors live in `domain/ | ||
| - | - [ ] Infrastructure returns domain sentinels — never `apperror` types directly (e.g. `sql.ErrNoRows` → `domainModel.ErrTodoNotFound`). | ||
| - [ ] Presentation middleware maps domain sentinels → HTTP codes via `errors.Is` / `errors.As` — this mapping lives only in middleware, never in usecase or infrastructure. | - [ ] Presentation middleware maps domain sentinels → HTTP codes via `errors.Is` / `errors.As` — this mapping lives only in middleware, never in usecase or infrastructure. | ||
| - [ ] `AppError.Err` (internal error) must never be serialized to the client response. | - [ ] `AppError.Err` (internal error) must never be serialized to the client response. | ||
| - | - [ ] No raw SQL errors, gRPC status codes, or stack traces in HTTP responses. | ||
| --- | --- | ||
| Line 136: | Line 134: | ||
| - [ ] Define interfaces in the **consumer package**, not in the implementor' | - [ ] Define interfaces in the **consumer package**, not in the implementor' | ||
| + | - **Exception for this project:** `TodoRepository`, | ||
| - [ ] Keep interfaces minimal — only the methods the consumer actually calls. | - [ ] Keep interfaces minimal — only the methods the consumer actually calls. | ||
| - [ ] Flag any interface with 5+ methods as a potential fat interface violation. | - [ ] Flag any interface with 5+ methods as a potential fat interface violation. | ||
ai/prompt/review-pr-golang.1781186937.txt.gz · Last modified: by phong2018
