# 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