Go 1.22 backend for a narrowed China-market research workflow:
- Upload a parseable PDF/Word/text document
- Deduplicate by SHA256 and store the original bytes in MySQL
- Extract plain text from the file
- Ask the LLM layer to extract structured trade intent only
- Generate stable T+1 candidate plans with deterministic rules
- Persist and query results
- Supported input:
.pdf,.doc,.docx,.txt,.md,.csv - Storage model: raw document bytes stored in MySQL
- Parsing: plain-text extraction only
- Analysis: structured trade intent extraction from text
- Rules: deterministic generation of entry, stop loss, take profit, position
- Database access:
gorm.io/gorm+gorm.io/driver/mysql - Model generation:
gorm.io/gen - API:
GET /healthzGET /api/v1/documentsPOST /api/v1/documents/uploadPOST /api/v1/documents/{id}/analyzeGET /api/v1/documents/{id}/plansGET /api/v1/plansPOST /api/v1/admin/config/reload
- Database models live in
internal/domain/db_model. - DAL singletons live in
internal/dal. - Every DAL DML method accepts
ctx context.Contextanddb *gorm.DB. - Query methods use
dal.QueryParam; update methods usedal.UpdateParam. - DAL exposes concrete methods for callers, such as
QueryByID,QueryLatestByDocumentID, andUpdateStatusByID. - DAL accepts and returns
internal/domain/db_modelrecords or primitive values. - Service code owns transactions and conversion between domain models and database models.
sqlcis no longer part of the project.
generate.go follows the same config-loading path as the API bootstrap: it reads Nacos bootstrap environment variables, loads the Nacos JSON config, extracts the MySQL DSN, connects to MySQL, and runs gorm.io/gen.
go run generate.goIf Nacos bootstrap variables are absent, it follows the API's local development fallback and reads configs/example_nacos_config.json.
- Market provider chain
- Approval flow
- T+1 evaluation
- Scorecard/reporting
- Worker and scheduler
- Redis and object storage dependencies in the runtime path
- HTML/email/table/OCR side paths
go run ./cmd/apienv GOTOOLCHAIN=local go test ./...
env GOTOOLCHAIN=local go build ./...