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>
30 lines
749 B
Go
30 lines
749 B
Go
//go:build ignore
|
|
|
|
// EXAMPLE — reference shape for AI. Not compiled into apps/api.
|
|
package examples
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
)
|
|
|
|
type DecodeRepo interface {
|
|
SaveDecode(ctx context.Context, userID string, summary string) error
|
|
}
|
|
|
|
type DecodeServiceImpl struct {
|
|
Repo DecodeRepo
|
|
}
|
|
|
|
func (s *DecodeServiceImpl) Decode(ctx context.Context, in DecodeInput) (*DecodeOutput, error) {
|
|
if in.Year < 1900 || in.Month < 1 || in.Month > 12 || in.Day < 1 || in.Day > 31 {
|
|
return nil, fmt.Errorf("invalid birth date")
|
|
}
|
|
// engine would run here
|
|
summary := "简版结论占位"
|
|
if err := s.Repo.SaveDecode(ctx, "user-from-ctx", summary); err != nil {
|
|
return nil, fmt.Errorf("save decode: %w", err)
|
|
}
|
|
return &DecodeOutput{Summary: summary}, nil
|
|
}
|