docs: update README

This commit is contained in:
zhuyasen 2025-05-20 21:46:26 +08:00
parent ca46c09c25
commit eb725020d4
4 changed files with 43 additions and 142 deletions

View File

@ -15,7 +15,9 @@
</div>
**Sponge** is a powerful and easy-to-use `Go` development framework. Its core concept is to reverse-generate modular code by parsing `SQL`, `Protobuf`, and `JSON` files. These modular components can be flexibly combined into various types of complete backend services. Featuring a modular architecture and deeply integrated AI assistant, sponge significantly improves development efficiency and lowers the technical barrier, enabling the effortless construction of high-performance, highly available backend systems through a low-code approach.
**Sponge** is a powerful and easy-to-use `Go` development framework. Its core concept is to reverse-generate modular code by parsing `SQL`, `Protobuf`, and `JSON` files. These modular components can be flexibly combined into various types of complete backend services.
Sponge provides a one-stop project development solution with outstanding engineering capabilities. It covers code generation, development, testing, API documentation, and deployment, enabling developers to effortlessly build stable, reliable, and high-performance backend service systems (including RESTful API, gRPC, HTTP+gRPC, and gRPC Gateway, etc) with a low-code approach.
<br>
@ -23,13 +25,11 @@
**Sponge** is ideal for rapidly building various types of high-performance backend services. Applicable scenarios include:
* Developing internal enterprise API services
* Quickly building microservices
* Creating APIs for backend management systems
* Building gRPC services for inter-service communication
* Serving as a starting point for Go beginners or teams to learn Go project structure and best practices
* Supporting teams that need to improve development efficiency and standardize coding practices
* Cloud-native development
- **Developing RESTful API services**
- **Building microservices projects**
- **Cloud-native development**
- **Refactoring old projects**
- **Serving as a starting point for Go beginners or teams to learn Go project structure and best practices**
In addition, developers can generate business-specific code by customizing templates.
@ -38,7 +38,7 @@ In addition, developers can generate business-specific code by customizing templ
### Key Features
1. **One-click generation of complete backend service code**
For `Web` or `gRPC` services that only require `CRUD APIs`, no `Go` code needs to be written. Simply connect to a database (e.g., `MySQL`, `MongoDB`, `PostgreSQL`, `SQLite`) to one-click generate complete backend service code and easily deploy it to Linux servers, Docker, or Kubernetes.
For `Web`, `gRPC` or `HTTP+gRPC` services that only require `CRUD APIs`, no `Go` code needs to be written. Simply connect to a database (e.g., `MySQL`, `MongoDB`, `PostgreSQL`, `SQLite`) to one-click generate complete backend service code and easily deploy it to Linux servers, Docker, or Kubernetes.
2. **Efficient development of general-purpose services**
When developing general-purpose `Web`, `gRPC`, `HTTP+gRPC`, or `gRPC Gateway` services, you only need to focus on three aspects:
@ -49,20 +49,15 @@ In addition, developers can generate business-specific code by customizing templ
The framework code and CRUD API code are all automatically generated by sponge.
3. **Support for custom templates, offering flexible extensibility**
Sponge supports generating various types of project-specific code using custom templates, not limited to the `Go` language. For example:
- Backend code;
- Frontend code;
- Configuration files;
- Test code;
- Build and deployment scripts, etc.
Sponge supports generating various types of project-specific code using custom templates, not limited to the `Go` language. For example `backend code`, `frontend code`, `test code`, `build and deployment scripts`, etc.
4. **Generate code on the page, simple and easy to use**
Sponge provides code generation on the page, avoiding complex command-line operations, simply filling in parameters on the page to generate code with one click.
5. **Sponge collaborate with the AI assistants for a closed-loop development process**
Sponge deeply integrates with built-in AI assistants (DeepSeek, ChatGPT, Gemini) to form a complete and highly efficient development solution:
- **Sponge**: Handles infrastructure code generation (service framework, CRUD API interfaces, and custom API interfaces code without business logic implementation).
- **AI assistant**: Focuses on business logic implementation (table structure DDL design, custom API interface definition, and business logic implementation code).
5. **Sponge and AI Assistant Collaborative Development to Form a Closed-Loop Workflow**
Sponge, combined with built-in AI assistants (DeepSeek, ChatGPT, Gemini), forms a complete and efficient development solution:
- **Sponge**: Responsible for infrastructure code generation, including `service framework`, `CRUD API`, `custom API (lacking business logic)`, etc.
- **AI assistant**: Focuses on business logic implementation, including `table structure DDL design`, `custom API design`, `business logic`, etc.
<br>
@ -174,12 +169,6 @@ Click to view the [**test code**](https://github.com/zhufuyi/microservices_frame
<br>
### sponge Development Guide
You're welcome to explore the [complete technical documentation for the Sponge project](https://go-sponge.com/), which provides in-depth coverage of core topics such as code generation, development workflows, system configuration, and deployment strategies.
<br>
### Project Code Directory Structure
The project code directory structure created by sponge follows the [project-layout](https://github.com/golang-standards/project-layout).
@ -240,6 +229,12 @@ Sponge supports creating three types of project code structures: `Monolithic app
<br>
### Sponge Documentation
Click to view [Sponge Documentation](https://go-sponge.com/), which covers core content such as code generation, development process, system configuration and deployment plan in detail.
<br>
### Examples
#### Sponge Create Server Code Examples

View File

@ -2,7 +2,9 @@
<br>
**sponge** 是一个强大且易用的 `Go` 开发框架,其核心理念是通过解析 `SQL`、`Protobuf`、`JSON` 文件逆向生成模块化的代码这些模块代码可灵活组合成多种类型的完整后端服务。sponge 采用模块化架构并深度集成 AI 助手,显著提升开发效率、降低技术门槛,以"低代码"方式轻松构建高性能、高可用的后端服务体系。
**sponge** 是一个强大且易用的 `Go` 开发框架,其核心理念是通过解析 `SQL`、`Protobuf`、`JSON` 文件逆向生成模块化的代码,这些模块代码可灵活组合成多种类型的完整后端服务。
sponge 提供一站式项目开发解决方案拥有出色的项目工程化能力涵盖代码生成、开发、测试、API 文档和部署等,帮助开发者以"低代码"方式轻松构建稳定可靠的高性能后端服务体系(包括 RESTful API、gRPC、HTTP+gRPC、gRPC Gateway 等)。
<br>
@ -10,13 +12,11 @@
sponge 适用于快速构建多种类型的高性能后端服务,适用场景如下:
- 开发企业内部 API 服务。
- 快速构建微服务 (Microservices)。
- 搭建后台管理系统 API。
- 构建 gRPC 服务进行服务间通信。
- 作为 Go 初学者或团队学习 Go 项目结构和最佳实践的起点。
- 需要提高开发效率、统一开发规范的团队。
- 云原生开发。
- **开发 RESTful API 服务**
- **构建微服务项目**
- **云原生开发**
- **重构旧有项目**
- **作为 Go 初学者或团队学习 Go 项目结构和最佳实践的起点**
此外,开发者还可以通过自定义模板,生成满足业务需求的各类代码。
@ -25,7 +25,7 @@ sponge 适用于快速构建多种类型的高性能后端服务,适用场景
### 主要特点
1. **一键生成完整后端服务代码**
对于仅需 `CRUD API``Web``gRPC` 服务,无需编写任何 `Go` 代码。只需连接数据库(如 `MySQL`、`MongoDB`、`PostgreSQL`、`SQLite`),即可一键生成完整后端服务代码,并轻松部署到 Linux 服务器、Docker 或 Kubernetes 上。
对于仅需 `CRUD API``Web`、`gRPC`或`HTTP+gRPC`服务,无需编写任何 `Go` 代码。只需连接数据库(如 `MySQL`、`MongoDB`、`PostgreSQL`、`SQLite`),即可一键生成完整后端服务代码,并轻松部署到 Linux 服务器、Docker 或 Kubernetes 上。
2. **高效开发通用服务**
开发通用的 `Web`、`gRPC`、`HTTP+gRPC` 或 `gRPC Gateway` 服务,只需专注于以下三部分:
@ -36,20 +36,15 @@ sponge 适用于快速构建多种类型的高性能后端服务,适用场景
服务的框架代码和 CRUD API 代码均由 sponge 自动生成。
3. **支持自定义模板,灵活扩展**
sponge 支持通过自定义模板生成项目所需的多种代码类型,不局限于 `Go` 语言。例如:
- 后端代码;
- 前端代码;
- 配置文件;
- 测试代码;
- 构建和部署脚本等。
sponge 支持通过自定义模板生成项目所需的多种代码类型,不局限于 `Go` 语言。例如`后端代码`、`前端代码`、`测试代码`、`构建和部署脚本`等。
4. **在页面生成代码,简单易用**
sponge 提供在页面生成代码,避免了复杂的命令行操作,只需在页面上简单的填写参数即可一键生成代码。
5. **与 AI 助手协同开发,形成开发闭环**
sponge 与 内置的 AI 助手(DeepSeek、ChatGPT、Gemini)深度融合,形成一套完整的高效开发解决方案:
- **sponge**:负责基础设施代码生成(服务框架、CRUD API 接口、自定义 API 接口代码(缺少业务逻辑)等)
- **AI助手**:专注业务逻辑实现(表结构 DDL 设计、自定义 API 接口定义、业务逻辑实现代码)
5. **sponge 与 AI 助手协同开发,形成开发闭环**
sponge 与 内置的 AI 助手(DeepSeek、ChatGPT、Gemini) 结合形成一套完整的高效开发解决方案:
- **sponge**:负责基础设施代码生成,包括`服务框架`、`CRUD API`、`自定义 API(缺少业务逻辑)`等代码
- **AI助手**:专注业务逻辑实现,包括`表结构 DDL 设计`、`自定义 API 设计`、`业务逻辑`等代码
<br>
@ -161,12 +156,6 @@ sponge 是一个现代化的 Go 微服务框架,它采用典型的微服务分
<br>
### sponge 开发指南
欢迎查阅 [Sponge 开发项目的完整技术文档](https://go-sponge.com/zh/),该文档详尽涵盖了代码生成、开发流程、系统配置及部署方案等核心内容。
<br>
### 目录结构
sponge 创建的服务代码目录结构遵循 [project-layout](https://github.com/golang-standards/project-layout)。
@ -227,6 +216,12 @@ sponge 支持创建 `单体应用单体仓库(monolith)`、`微服务多仓库(m
<br>
### sponge 文档
点击查看 [Sponge文档](https://go-sponge.com/zh/),该文档详尽涵盖了代码生成、开发流程、系统配置及部署方案等核心内容。
<br>
### 代码示例
#### sponge 创建服务代码示例

View File

@ -194,42 +194,7 @@ func (d *userExampleDao) GetByID(ctx context.Context, id string) (*model.UserExa
}
// GetByColumns get paging records by column information,
// Note: query performance degrades when table rows are very large because of the use of offset.
//
// params includes paging parameters and query parameters
// paging parameters (required):
//
// page: page number, starting from 0
// limit: lines per page
// sort: sort fields, default is id backwards, you can add - sign before the field to indicate reverse order, no - sign to indicate ascending order, multiple fields separated by comma
//
// query parameters (not required):
//
// name: column name, if value is of type objectId, the suffix :oid must be added, e.g. order_id:oid
// exp: expressions, which default is "=", support =, !=, >, >=, <, <=, like, in, notin
// value: column value, if exp=in, multiple values are separated by commas
// logic: logical type, default value is "and", support &, and, ||, or
//
// example: search for a male over 20 years of age
//
// params = &query.Params{
// Page: 0,
// Limit: 20,
// Columns: []query.Column{
// {
// Name: "age",
// Exp: ">",
// Value: 20,
// },
// {
// Name: "gender",
// Value: "male",
// },
// {
// Name: "post_id:oid", // suffix :oid is required for objectId type
// Value: "65ce48483f11aff697e30d6d",
// },
// }
// For more details, please refer to https://go-sponge.com/component/custom-page-query.html
func (d *userExampleDao) GetByColumns(ctx context.Context, params *query.Params) ([]*model.UserExample, int64, error) {
filter, err := params.ConvertToMongoFilter(query.WithWhitelistNames(model.UserExampleColumnNames))
if err != nil {

View File

@ -199,42 +199,7 @@ func (d *userExampleDao) GetByID(ctx context.Context, id string) (*model.UserExa
}
// GetByColumns get paging records by column information,
// Note: query performance degrades when table rows are very large because of the use of offset.
//
// params includes paging parameters and query parameters
// paging parameters (required):
//
// page: page number, starting from 0
// limit: lines per page
// sort: sort fields, default is id backwards, you can add - sign before the field to indicate reverse order, no - sign to indicate ascending order, multiple fields separated by comma
//
// query parameters (not required):
//
// name: column name, if value is of type objectId, the suffix :oid must be added, e.g. order_id:oid
// exp: expressions, which default is "=", support =, !=, >, >=, <, <=, like, in, notin
// value: column value, if exp=in, multiple values are separated by commas
// logic: logical type, default value is "and", support &, and, ||, or
//
// example: search for a male over 20 years of age
//
// params = &query.Params{
// Page: 0,
// Limit: 20,
// Columns: []query.Column{
// {
// Name: "age",
// Exp: ">",
// Value: 20,
// },
// {
// Name: "gender",
// Value: "male",
// },
// {
// Name: "post_id:oid", // suffix :oid is required for objectId type
// Value: "65ce48483f11aff697e30d6d",
// },
// }
// For more details, please refer to https://go-sponge.com/component/custom-page-query.html
func (d *userExampleDao) GetByColumns(ctx context.Context, params *query.Params) ([]*model.UserExample, int64, error) {
filter, err := params.ConvertToMongoFilter(query.WithWhitelistNames(model.UserExampleColumnNames))
if err != nil {
@ -285,26 +250,7 @@ func (d *userExampleDao) DeleteByIDs(ctx context.Context, ids []string) error {
}
// GetByCondition get a record by condition
// query conditions:
//
// name: column name, if value is of type objectId, the suffix :oid must be added, e.g. post_id:oid
// exp: expressions, which default is "=", support =, !=, >, >=, <, <=, like, in, notin
// value: column value, if exp=in, multiple values are separated by commas
// logic: logical type, default value is "and", support &, and, ||, or
//
// example: query the id of the post under the user James
//
// condition = &query.Conditions{
// Columns: []query.Column{
// {
// Name: "user_name",
// Value: "James",
// },
// {
// Name: "post_id:oid", // suffix :oid is required for objectId type
// Value: "65ce48483f11aff697e30d6d",
// },
// }
// For more details, please refer to https://go-sponge.com/component/custom-page-query.html#_2-condition-parameters-optional
func (d *userExampleDao) GetByCondition(ctx context.Context, c *query.Conditions) (*model.UserExample, error) {
filter, err := c.ConvertToMongo(query.WithWhitelistNames(model.UserExampleColumnNames))
if err != nil {