Files
jackyu66gitandCursor 2fb1dfee14 chore: seal Design Vision v1 and monorepo scaffold
Archive the differentiated YuXinGu product docs, AI engineering system,
design contract, and Go/Vue scaffold. Next execution prioritizes Cece-parity
over early innovation (see .ai/product/STRATEGY.md).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-02 16:00:44 +08:00

32 lines
610 B
Markdown

# Pattern: Service
## Responsibility
Business rules, authorization, orchestration, transactions.
## Shape
```go
type ReportRepo interface {
SaveReport(ctx context.Context, r *model.Report) error
}
type ReportService struct {
repo ReportRepo
}
func (s *ReportService) Decode(ctx context.Context, in DecodeInput) (*DecodeOutput, error) {
if err := in.Validate(); err != nil {
return nil, fmt.Errorf("validate decode: %w", err)
}
// rules / engine
// persist via repo
return out, nil
}
```
## Never
- Import `gin`
- Bypass repo with ad-hoc SQL drivers scattered around