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>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user