goframe-v2

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

重要规范

Important Specifications

工程开发规范

Engineering Development Specifications

  • 开发完整工程类型的项目如HTTP、微服务项目时,需要先安装GoFrame CLI开发工具,并使用CLI工具创建项目骨架,对应命令为gf init,命令的具体使用方式需参考文档项目创建-init
  • 在GoFrame工程规范中,由开发工具自动维护的代码文件,如dao、do、entity等源码文件,不允许手动创建或修改。
  • 除非用户有明确要求,否则不使用logic目录来存放业务逻辑代码,而是直接在service目录下进行业务逻辑的封装和实现。
  • 完整工程目录、代码封装以及源码实现的示例需参考已有示例项目,如:
    • HTTP项目最佳实践示例:user-http-service
    • gRPC项目最佳实践示例:user-grpc-service
  • When developing complete engineering-type projects such as HTTP and microservice projects, you need to install the GoFrame CLI development tool first, and use the CLI tool to create the project skeleton. The corresponding command is
    gf init
    . For the specific usage of the command, please refer to the document Project Creation - init.
  • In the GoFrame engineering specifications, code files automatically maintained by development tools, such as source files like dao, do, entity, etc., are not allowed to be manually created or modified.
  • Unless the user has clear requirements, do not use the logic directory to store business logic code; instead, directly encapsulate and implement business logic under the service directory.
  • For examples of complete project directories, code encapsulation, and source code implementation, please refer to existing sample projects, such as:
    • Best practice example for HTTP projects: user-http-service
    • Best practice example for gRPC projects: user-grpc-service

组件使用规范

Component Usage Specifications

  • 创建新的方法或变量前要先分析是否在其它位置中已经存在,尽量引用已有的实现。
  • 错误处理统一使用gerror组件,确保错误信息带有完整堆栈信息以提供可追踪性。
  • 在调研使用新组件时,优先考虑引用GoFrame框架中已有组件、优先参考示例代码中的最佳实践源码。
  • Before creating a new method or variable, first analyze whether it already exists in other locations, and try to reference existing implementations as much as possible.
  • Use the gerror component uniformly for error handling to ensure that error messages carry complete stack information for traceability.
  • When researching and using new components, prioritize referencing existing components in the GoFrame framework and refer to the best practice source code in the sample code first.

Go开发资料

Go Development Materials

完整的GoFrame开发资料,包含各类组件的设计介绍、使用说明、最佳实践、注意事项:GO开发资料
Complete GoFrame development materials, including design introductions, usage instructions, best practices, and precautions for various components: GO Development Materials

Go示例代码

Go Sample Code

丰富的GoFrame实战代码示例,涵盖HTTP服务、gRPC服务等多种项目类型:GO示例代码
Rich practical code examples for GoFrame, covering various project types such as HTTP services and gRPC services: GO Sample Code