How zsy619/yyhertz works
Project Type and Purpose
• This is an open-source Go Web framework (YYHertz) built on CloudWeGo-Hertz.
• It provides a Beego-style MVC layer, pluggable middleware, dual ORM (GORM + MyBatis) engine, configuration management, template engine, code-generation tools, and examples.
File Structure Analysis
• Top-level:
• framework/ – core modules (mvc, orm, mybatis, config, util, testing, version, cache, scheduler, etc.)
• example/ – sample applications demonstrating MVC, annotations, ORM, WebSocket, tools.
• cmd/ – CLI for codegen tasks.
• conf/ – YAML configuration files.
• docs/ – user guides, optimization notes, algorithm references.
• static/ – static assets for WebSocket tests.
• MVC subdirectories mirror the typical layering: context, controller, router, middleware, view, annotation, error handling, devtools, websocket.
• ORM (framework/orm) implements a manager + selector + engine plugins.
• MyBatis (framework/mybatis) implements XML parser, session/executor, plugin hooks.
• Configuration (framework/config) loads YAML via Viper, exposes typed configs (app, log, database, session, TLS, etc.).
• Build scripts and go.mod tie everything together.
README Insights
• Emphasizes MVC architecture, middleware pipeline (4 layers), Beego compatibility, auto-routing, health checks.
• Dual-engine ORM architecture: ORMManager → SmartSelector → {GORM engine, MyBatis engine} → RDBMS.
• High performance goals (Hertz HTTP server), production-ready features (error handling, graceful shutdown, metrics).
• Example usage of controllers, namespaces, middleware, ORM operations, and custom XML mappers.
Essential Details to Capture
• Distinct boundaries between user code and framework internals.
• The middleware pipeline order and how it composes.
• The dual-engine ORM flow, including the SmartSelector decision point.
• Configuration sources (conf/*.yaml) feeding into the Config Manager at startup.
• How templates, static assets, and WebSocket utils plug into the MVC core.