Skip to content

Commit 948b3f0

Browse files
committed
update docs
1 parent 61e8328 commit 948b3f0

File tree

11 files changed

+46
-15
lines changed

11 files changed

+46
-15
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
</div>
1717

18-
[Sponge](https://github.com/zhufuyi/sponge) is a powerful golang productivity tool that integrates `automatic code generation`, `web and microservices frameworks`, `basic development framework`. sponge has a wealth of generating code commands, generating different functional code can be combined into a complete service (similar to the way that artificially broken sponge cells can automatically recombine into a new sponge). The code is decoupled and modularly designed, it is easy to build a complete project from development to deployment, so that you develop web or microservices project easily, golang can also be "low-code development".
18+
**Sponge** is a basic development framework that integrates `code auto generation`, `gin and grpc`, sponge has a wealth of generating code commands, generating different functional code can be combined into a complete service (similar to the way that artificially broken sponge cells can automatically recombine into a new sponge). The code is decoupled and modularly designed, it is easy to build a complete project from development to deployment, so that you develop web or microservices project easily, Go can also be "low-code development".
1919

2020
<br>
2121

@@ -47,7 +47,7 @@ sponge is mainly based on **SQL** and **Protobuf** two ways to generate code, ea
4747

4848
### Services framework
4949

50-
sponge generated microservice code framework is shown in the figure below, which is a typical microservice hierarchical structure, with high performance, high scalability, contains commonly used service governance features, you can easily replace or add their own service governance features.
50+
Sponge is essentially a microservice framework that includes code generation and deployment capabilities. The microservice framework is shown in the following figure, which is a typical microservice hierarchical structure, with high performance, high scalability, contains commonly used service governance features, you can easily replace or add their own service governance features.
5151

5252
<p align="center">
5353
<img width="1000px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/microservices-framework.png">

assets/install-cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
下载protoc地址: [https://github.com/protocolbuffers/protobuf/releases/tag/v25.2](https://github.com/protocolbuffers/protobuf/releases/tag/v25.2)
1818

19-
> 要求v3.20以上版本,根据系统类型下载对应的 protoc 二进制文件,把 protoc 二进制文件移动到go二进制文件所在的目录。
19+
> 根据系统类型下载对应的 protoc 二进制文件,把 protoc 二进制文件移动到go二进制文件所在的目录。
2020
2121
查看protoc版本: `protoc --version`
2222

assets/install-en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Check go version: `go version`
1616

1717
Download protoc from: [https://github.com/protocolbuffers/protobuf/releases/tag/v25.2](https://github.com/protocolbuffers/protobuf/releases/tag/v25.2)
1818

19-
> Required version: v3.20 or above. Download the protoc binaries according to the system type, move the protoc binaries to the directory where the go binaries are located.
19+
> Download the protoc binaries according to the system type, move the protoc binaries to the directory where the go binaries are located.
2020
2121
Check protoc version: `protoc --version`
2222

assets/readme-cn.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
[sponge](https://github.com/zhufuyi/sponge) 是一个集成了`自动生成代码``web和微服务框架``基础开发框架`的golang生产力工具。sponge拥有丰富的生成代码命令,生成不同的功能代码可以组合成完整的服务(类似人为打散的海绵细胞可以自动重组成一个新的海绵)。代码解耦模块化设计,很容易构建出从开发到部署的完整工程项目,让你开发web或微服务项目轻而易举、事半功倍,golang也可以"低代码开发"。
1+
2+
3+
4+
[sponge](https://github.com/zhufuyi/sponge) 是一个集成了 `自动生成代码``gin和grpc` 的基础开发框架。sponge拥有丰富的生成代码命令,生成不同的功能代码可以组合成完整的服务(类似人为打散的海绵细胞可以自动重组成一个新的海绵)。代码解耦模块化设计,很容易构建出从开发到部署的完整工程项目,让你开发web或微服务项目轻而易举、事半功倍,使用go也可以"低代码开发"。
25

36
<br>
47

@@ -30,7 +33,7 @@ sponge主要基于**SQL**和**Protobuf**两种方式生成代码,每种方式
3033

3134
### 微服务框架
3235

33-
sponge生成的微服务代码框架如下图所示,这是典型的微服务分层结构,具有高性能,高扩展性,包含了常用的服务治理功能,可以很方便替换或添加自己的服务治理功能。
36+
sponge本质是一个包含了生成代码和部署功能的微服务框架,微服务框架如下图所示,这是典型的微服务分层结构,具有高性能,高扩展性,包含了常用的服务治理功能,可以很方便替换或添加自己的服务治理功能。
3437

3538
<p align="center">
3639
<img width="1000px" src="https://raw.githubusercontent.com/zhufuyi/sponge/main/assets/microservices-framework.png">

pkg/ggorm/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
### mysql
1+
### ggorm
22

3-
`mysql` library wrapped in [gorm](gorm.io/gorm), with added features such as tracer, paging queries, etc.
3+
`ggorm` library wrapped in [gorm](gorm.io/gorm), with added features such as tracer, paging queries, etc.
4+
5+
Support `mysql`, `postgresql`, `tidb`, `clickhouse`, `sqlite`.
46

57
<br>
68

pkg/ggorm/base_model.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package mysql
1+
package ggorm
22

33
import (
44
"reflect"

pkg/ggorm/gorm.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Package mysql is a library wrapped on top of gorm.io/gorm, with added features such as link tracing, paging queries, etc.
2-
package mysql
1+
// Package ggorm is a library wrapped on top of gorm.io/gorm, with added features such as link tracing, paging queries, etc.
2+
package ggorm
33

44
import (
55
"database/sql"
@@ -100,6 +100,21 @@ func InitPostgresql(dsn string, opts ...Option) (*gorm.DB, error) {
100100
return db, nil
101101
}
102102

103+
// InitTidb init tidb
104+
func InitTidb(dsn string, opts ...Option) (*gorm.DB, error) {
105+
return InitMysql(dsn, opts...)
106+
}
107+
108+
// InitClickhouse init clickhouse
109+
//func InitClickhouse(dsn string, opts ...Option) (*gorm.DB, error) {
110+
// return InitMysql(dsn, opts...)
111+
//}
112+
113+
// InitSqlite init sqlite
114+
//func InitSqlite(dsn string, opts ...Option) (*gorm.DB, error) {
115+
// panic("not implemented")
116+
//}
117+
103118
// gorm setting
104119
func gormConfig(o *options) *gorm.Config {
105120
config := &gorm.Config{

pkg/ggorm/gormLogger.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package mysql
1+
package ggorm
22

33
import (
44
"context"

pkg/ggorm/gormLogger_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package mysql
1+
package ggorm
22

33
import (
44
"context"

pkg/ggorm/gorm_test.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package mysql
1+
package ggorm
22

33
import (
44
"fmt"
@@ -21,6 +21,17 @@ func TestInitMysql(t *testing.T) {
2121
t.Logf("%+v", db.Name())
2222
}
2323

24+
func TestInitTidb(t *testing.T) {
25+
db, err := InitTidb(dsn)
26+
if err != nil {
27+
// ignore test error about not being able to connect to real tidb
28+
t.Logf(fmt.Sprintf("connect to mysql failed, err=%v, dsn=%s", err, dsn))
29+
return
30+
}
31+
32+
t.Logf("%+v", db.Name())
33+
}
34+
2435
func TestInitPostgresql(t *testing.T) {
2536
dsn = "host=192.168.3.37 user=root password=123456 dbname=account port=5432 sslmode=disable TimeZone=Asia/Shanghai"
2637
db, err := InitPostgresql(dsn, WithEnableTrace())

0 commit comments

Comments
 (0)