Skip to content

Commit 876b7cc

Browse files
authored
Merge pull request #475 from TarsCloud/perf/lbbniu/gin
deps(gin): update gin examples
2 parents 72ad3a6 + 4beacb3 commit 876b7cc

File tree

3 files changed

+25
-23
lines changed

3 files changed

+25
-23
lines changed

examples/GinHttpServer/config.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
server=HttpServer
66
local=tcp -h 127.0.0.1 -p 13014 -t 30000
77
logpath=/tmp
8-
<Gin.HttpServer.HttpsObjAdapter>
8+
<Gin.HttpServer.HttpObjAdapter>
99
allow
1010
endpoint=tcp -h 127.0.0.1 -p 8088 -t 60000
1111
handlegroup=Gin.HttpServer.HttpObjAdapter

examples/GinHttpServer/go.mod

+20-18
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,36 @@ module gin
33
go 1.17
44

55
require (
6-
github.com/TarsCloud/TarsGo v0.0.0-00010101000000-000000000000
7-
github.com/gin-gonic/gin v1.9.0
6+
github.com/TarsCloud/TarsGo v1.4.3
7+
github.com/TarsCloud/TarsGo/contrib/gin v0.0.1-bate3
8+
github.com/gin-gonic/gin v1.9.1
89
)
910

1011
require (
11-
github.com/bytedance/sonic v1.8.0 // indirect
12+
github.com/bytedance/sonic v1.9.1 // indirect
1213
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
14+
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
1315
github.com/gin-contrib/sse v0.1.0 // indirect
1416
github.com/go-playground/locales v0.14.1 // indirect
1517
github.com/go-playground/universal-translator v0.18.1 // indirect
16-
github.com/go-playground/validator/v10 v10.11.2 // indirect
17-
github.com/goccy/go-json v0.10.0 // indirect
18+
github.com/go-playground/validator/v10 v10.14.0 // indirect
19+
github.com/goccy/go-json v0.10.2 // indirect
1820
github.com/json-iterator/go v1.1.12 // indirect
19-
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
20-
github.com/leodido/go-urn v1.2.1 // indirect
21-
github.com/mattn/go-isatty v0.0.17 // indirect
22-
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
21+
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
22+
github.com/leodido/go-urn v1.2.4 // indirect
23+
github.com/mattn/go-isatty v0.0.19 // indirect
24+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
2325
github.com/modern-go/reflect2 v1.0.2 // indirect
24-
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
26+
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
2527
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
26-
github.com/ugorji/go/codec v1.2.9 // indirect
27-
go.uber.org/automaxprocs v1.5.1 // indirect
28-
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
29-
golang.org/x/crypto v0.5.0 // indirect
30-
golang.org/x/net v0.7.0 // indirect
31-
golang.org/x/sys v0.5.0 // indirect
32-
golang.org/x/text v0.7.0 // indirect
33-
google.golang.org/protobuf v1.28.1 // indirect
28+
github.com/ugorji/go/codec v1.2.11 // indirect
29+
go.uber.org/automaxprocs v1.5.2 // indirect
30+
golang.org/x/arch v0.3.0 // indirect
31+
golang.org/x/crypto v0.9.0 // indirect
32+
golang.org/x/net v0.10.0 // indirect
33+
golang.org/x/sys v0.8.0 // indirect
34+
golang.org/x/text v0.9.0 // indirect
35+
google.golang.org/protobuf v1.30.0 // indirect
3436
gopkg.in/yaml.v3 v3.0.1 // indirect
3537
)
3638

examples/GinHttpServer/main.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
package main
22

33
import (
4+
cgin "github.com/TarsCloud/TarsGo/contrib/gin"
45
"github.com/TarsCloud/TarsGo/tars"
56
"github.com/gin-gonic/gin"
67
)
78

89
func main() {
9-
mux := &tars.TarsHttpMux{}
10-
r := mux.GetGinEngine()
11-
r.GET("/ping", func(c *gin.Context) {
10+
g := cgin.New()
11+
g.GET("/ping", func(c *gin.Context) {
1212
c.JSON(200, gin.H{
1313
"message": "pong",
1414
})
1515
})
1616

1717
// Get server config
1818
cfg := tars.GetServerConfig()
19-
tars.AddHttpServant(mux, cfg.App+"."+cfg.Server+".HttpObj")
19+
tars.AddHttpServant(g, cfg.App+"."+cfg.Server+".HttpObj")
2020
tars.Run()
2121
}

0 commit comments

Comments
 (0)