Skip to content

Commit a81d898

Browse files
authored
chore: update go-zero version (#5093)
Signed-off-by: kevin <wanjunfeng@gmail.com>
1 parent a5d42e2 commit a81d898

File tree

16 files changed

+99
-107
lines changed

16 files changed

+99
-107
lines changed

core/mapping/marshaler.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ func validateOptions(value reflect.Value, opt *fieldOptions) error {
157157
if !slices.Contains(opt.Options, val) {
158158
return fmt.Errorf("field %q not in options", val)
159159
}
160+
160161
return nil
161162
}
162163

tools/goctl/api/gogen/genroutes.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ func formatDuration(duration time.Duration) string {
226226
}
227227

228228
func genRouteImports(parentPkg string, api *spec.ApiSpec) string {
229-
importSet := collection.NewSet()
230-
importSet.AddStr(fmt.Sprintf("\"%s\"", pathx.JoinPackages(parentPkg, contextDir)))
229+
importSet := collection.NewSet[string]()
230+
importSet.Add(fmt.Sprintf("\"%s\"", pathx.JoinPackages(parentPkg, contextDir)))
231231
for _, group := range api.Service.Groups {
232232
for _, route := range group.Routes {
233233
folder := route.GetAnnotation(groupProperty)
@@ -237,11 +237,11 @@ func genRouteImports(parentPkg string, api *spec.ApiSpec) string {
237237
continue
238238
}
239239
}
240-
importSet.AddStr(fmt.Sprintf("%s \"%s\"", toPrefix(folder),
240+
importSet.Add(fmt.Sprintf("%s \"%s\"", toPrefix(folder),
241241
pathx.JoinPackages(parentPkg, handlerDir, folder)))
242242
}
243243
}
244-
imports := importSet.KeysStr()
244+
imports := importSet.Keys()
245245
sort.Strings(imports)
246246
projectSection := strings.Join(imports, "\n\t")
247247
depSection := fmt.Sprintf("\"%s/rest\"", vars.ProjectOpenSourceURL)

tools/goctl/api/gogen/gentypes.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func getTypeName(tp spec.Type) string {
5959

6060
func genTypesWithGroup(dir string, cfg *config.Config, api *spec.ApiSpec) error {
6161
groupTypes := make(map[string]map[string]spec.Type)
62-
typesBelongToFiles := make(map[string]*collection.Set)
62+
typesBelongToFiles := make(map[string]*collection.Set[string])
6363

6464
for _, v := range api.Service.Groups {
6565
group := v.GetAnnotation(groupProperty)
@@ -75,37 +75,37 @@ func genTypesWithGroup(dir string, cfg *config.Config, api *spec.ApiSpec) error
7575
responseTypeName := getTypeName(v.ResponseType)
7676
requestTypeFileSet, ok := typesBelongToFiles[requestTypeName]
7777
if !ok {
78-
requestTypeFileSet = collection.NewSet()
78+
requestTypeFileSet = collection.NewSet[string]()
7979
}
8080
if len(requestTypeName) > 0 {
81-
requestTypeFileSet.AddStr(group)
81+
requestTypeFileSet.Add(group)
8282
typesBelongToFiles[requestTypeName] = requestTypeFileSet
8383
}
8484

8585
responseTypeFileSet, ok := typesBelongToFiles[responseTypeName]
8686
if !ok {
87-
responseTypeFileSet = collection.NewSet()
87+
responseTypeFileSet = collection.NewSet[string]()
8888
}
8989
if len(responseTypeName) > 0 {
90-
responseTypeFileSet.AddStr(group)
90+
responseTypeFileSet.Add(group)
9191
typesBelongToFiles[responseTypeName] = responseTypeFileSet
9292
}
9393
}
9494
}
9595

96-
typesInOneFile := make(map[string]*collection.Set)
96+
typesInOneFile := make(map[string]*collection.Set[string])
9797
for typeName, fileSet := range typesBelongToFiles {
9898
count := fileSet.Count()
9999
switch {
100100
case count == 0: // it means there has no structure type or no request/response body
101101
continue
102102
case count == 1: // it means a structure type used in only one group.
103-
groupName := fileSet.KeysStr()[0]
103+
groupName := fileSet.Keys()[0]
104104
typeSet, ok := typesInOneFile[groupName]
105105
if !ok {
106-
typeSet = collection.NewSet()
106+
typeSet = collection.NewSet[string]()
107107
}
108-
typeSet.AddStr(typeName)
108+
typeSet.Add(typeName)
109109
typesInOneFile[groupName] = typeSet
110110
default: // it means this type is used in multiple groups.
111111
continue
@@ -133,7 +133,7 @@ func genTypesWithGroup(dir string, cfg *config.Config, api *spec.ApiSpec) error
133133
}
134134

135135
if typeCount == 1 { // belong to one group
136-
groupName := groupSet.KeysStr()[0]
136+
groupName := groupSet.Keys()[0]
137137
types, ok := groupTypes[groupName]
138138
if !ok {
139139
types = make(map[string]spec.Type)

tools/goctl/api/gogen/util.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,29 +115,29 @@ func writeProperty(writer io.Writer, name, tag, comment string, tp spec.Type, in
115115
}
116116

117117
func getAuths(api *spec.ApiSpec) []string {
118-
authNames := collection.NewSet()
118+
authNames := collection.NewSet[string]()
119119
for _, g := range api.Service.Groups {
120120
jwt := g.GetAnnotation("jwt")
121121
if len(jwt) > 0 {
122122
authNames.Add(jwt)
123123
}
124124
}
125-
return authNames.KeysStr()
125+
return authNames.Keys()
126126
}
127127

128128
func getJwtTrans(api *spec.ApiSpec) []string {
129-
jwtTransList := collection.NewSet()
129+
jwtTransList := collection.NewSet[string]()
130130
for _, g := range api.Service.Groups {
131131
jt := g.GetAnnotation(jwtTransKey)
132132
if len(jt) > 0 {
133133
jwtTransList.Add(jt)
134134
}
135135
}
136-
return jwtTransList.KeysStr()
136+
return jwtTransList.Keys()
137137
}
138138

139139
func getMiddleware(api *spec.ApiSpec) []string {
140-
result := collection.NewSet()
140+
result := collection.NewSet[string]()
141141
for _, g := range api.Service.Groups {
142142
middleware := g.GetAnnotation("middleware")
143143
if len(middleware) > 0 {
@@ -147,7 +147,7 @@ func getMiddleware(api *spec.ApiSpec) []string {
147147
}
148148
}
149149

150-
return result.KeysStr()
150+
return result.Keys()
151151
}
152152

153153
func responseGoTypeName(r spec.Route, pkg ...string) string {

tools/goctl/go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ require (
1616
github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1
1717
github.com/zeromicro/antlr v0.0.1
1818
github.com/zeromicro/ddl-parser v1.0.5
19-
github.com/zeromicro/go-zero v1.8.5
19+
github.com/zeromicro/go-zero v1.9.0
2020
golang.org/x/text v0.22.0
2121
google.golang.org/grpc v1.65.0
2222
google.golang.org/protobuf v1.36.5
@@ -42,13 +42,12 @@ require (
4242
github.com/go-openapi/jsonreference v0.21.0 // indirect
4343
github.com/go-openapi/swag v0.23.1 // indirect
4444
github.com/gogo/protobuf v1.3.2 // indirect
45-
github.com/golang/mock v1.6.0 // indirect
4645
github.com/golang/protobuf v1.5.4 // indirect
4746
github.com/google/gnostic-models v0.6.8 // indirect
4847
github.com/google/go-cmp v0.6.0 // indirect
4948
github.com/google/gofuzz v1.2.0 // indirect
5049
github.com/google/uuid v1.6.0 // indirect
51-
github.com/grafana/pyroscope-go v1.2.2 // indirect
50+
github.com/grafana/pyroscope-go v1.2.4 // indirect
5251
github.com/grafana/pyroscope-go/godeltaprof v0.1.8 // indirect
5352
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
5453
github.com/inconshreveable/mousetrap v1.1.0 // indirect
@@ -73,7 +72,7 @@ require (
7372
github.com/prometheus/client_model v0.6.1 // indirect
7473
github.com/prometheus/common v0.62.0 // indirect
7574
github.com/prometheus/procfs v0.15.1 // indirect
76-
github.com/redis/go-redis/v9 v9.11.0 // indirect
75+
github.com/redis/go-redis/v9 v9.12.1 // indirect
7776
github.com/spaolacci/murmur3 v1.1.0 // indirect
7877
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect
7978
github.com/yuin/gopher-lua v1.1.1 // indirect
@@ -93,6 +92,7 @@ require (
9392
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
9493
go.uber.org/atomic v1.10.0 // indirect
9594
go.uber.org/automaxprocs v1.6.0 // indirect
95+
go.uber.org/mock v0.4.0 // indirect
9696
go.uber.org/multierr v1.9.0 // indirect
9797
go.uber.org/zap v1.24.0 // indirect
9898
golang.org/x/crypto v0.33.0 // indirect

tools/goctl/go.sum

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4
5757
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
5858
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
5959
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
60-
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
61-
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
6260
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
6361
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
6462
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
@@ -75,8 +73,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
7573
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
7674
github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0=
7775
github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w=
78-
github.com/grafana/pyroscope-go v1.2.2 h1:uvKCyZMD724RkaCEMrSTC38Yn7AnFe8S2wiAIYdDPCE=
79-
github.com/grafana/pyroscope-go v1.2.2/go.mod h1:zzT9QXQAp2Iz2ZdS216UiV8y9uXJYQiGE1q8v1FyhqU=
76+
github.com/grafana/pyroscope-go v1.2.4 h1:B22GMXz+O0nWLatxLuaP7o7L9dvP0clLvIpmeEQQM0Q=
77+
github.com/grafana/pyroscope-go v1.2.4/go.mod h1:zzT9QXQAp2Iz2ZdS216UiV8y9uXJYQiGE1q8v1FyhqU=
8078
github.com/grafana/pyroscope-go/godeltaprof v0.1.8 h1:iwOtYXeeVSAeYefJNaxDytgjKtUuKQbJqgAIjlnicKg=
8179
github.com/grafana/pyroscope-go/godeltaprof v0.1.8/go.mod h1:2+l7K7twW49Ct4wFluZD3tZ6e0SjanjcUUBPVD/UuGU=
8280
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0=
@@ -148,8 +146,8 @@ github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ
148146
github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkqml0W5zIY1I=
149147
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
150148
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
151-
github.com/redis/go-redis/v9 v9.11.0 h1:E3S08Gl/nJNn5vkxd2i78wZxWAPNZgUNTp8WIJUAiIs=
152-
github.com/redis/go-redis/v9 v9.11.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
149+
github.com/redis/go-redis/v9 v9.12.1 h1:k5iquqv27aBtnTm2tIkROUDp8JBXhXZIVu1InSgvovg=
150+
github.com/redis/go-redis/v9 v9.12.1/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
153151
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
154152
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
155153
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
@@ -179,15 +177,14 @@ github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 h1:QldyIu/L63oPpyvQmHg
179177
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778/go.mod h1:2MuV+tbUrU1zIOPMxZ5EncGwgmMJsa+9ucAQZXxsObs=
180178
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
181179
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
182-
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
183180
github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M=
184181
github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
185182
github.com/zeromicro/antlr v0.0.1 h1:CQpIn/dc0pUjgGQ81y98s/NGOm2Hfru2NNio2I9mQgk=
186183
github.com/zeromicro/antlr v0.0.1/go.mod h1:nfpjEwFR6Q4xGDJMcZnCL9tEfQRgszMwu3rDz2Z+p5M=
187184
github.com/zeromicro/ddl-parser v1.0.5 h1:LaVqHdzMTjasua1yYpIYaksxKqRzFrEukj2Wi2EbWaQ=
188185
github.com/zeromicro/ddl-parser v1.0.5/go.mod h1:ISU/8NuPyEpl9pa17Py9TBPetMjtsiHrb9f5XGiYbo8=
189-
github.com/zeromicro/go-zero v1.8.5 h1:YkdQhYllE+BPOrxcni0oCewebs7qHfXvjN9glnpcmJQ=
190-
github.com/zeromicro/go-zero v1.8.5/go.mod h1:P0DKW1vJx+2J3TReptbeg0H9tRSvehymr0HX4SCfZ6g=
186+
github.com/zeromicro/go-zero v1.9.0 h1:hlVtQCSHPszQdcwZTawzGwTej1G2mhHybYzMRLuwCt4=
187+
github.com/zeromicro/go-zero v1.9.0/go.mod h1:TMyCxiaOjLQ3YxyYlJrejaQZF40RlzQ3FVvFu5EbcV4=
191188
go.etcd.io/etcd/api/v3 v3.5.15 h1:3KpLJir1ZEBrYuV2v+Twaa/e2MdDCEZ/70H+lzEiwsk=
192189
go.etcd.io/etcd/api/v3 v3.5.15/go.mod h1:N9EhGzXq58WuMllgH9ZvnEr7SI9pS0k0+DHZezGp7jM=
193190
go.etcd.io/etcd/client/pkg/v3 v3.5.15 h1:fo0HpWz/KlHGMCC+YejpiCmyWDEuIpnTDzpJLB5fWlA=
@@ -222,6 +219,8 @@ go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs=
222219
go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8=
223220
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
224221
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
222+
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
223+
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
225224
go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI=
226225
go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ=
227226
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
@@ -233,33 +232,26 @@ golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
233232
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
234233
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
235234
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
236-
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
237235
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
238236
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
239237
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
240238
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
241-
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
242239
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
243240
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
244241
golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE=
245242
golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
246243
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
247244
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
248245
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
249-
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
250246
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
251247
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
252248
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
253249
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
254250
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
255-
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
256-
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
257-
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
258251
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
259252
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
260253
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
261254
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
262-
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
263255
golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
264256
golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
265257
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -272,7 +264,6 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
272264
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
273265
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
274266
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
275-
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
276267
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=
277268
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
278269
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

tools/goctl/model/sql/command/command.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,14 @@ func MySqlDataSource(_ *cobra.Command, _ []string) error {
145145
}
146146

147147
func mergeColumns(columns []string) []string {
148-
set := collection.NewSet()
148+
set := collection.NewSet[string]()
149149
for _, v := range columns {
150150
fields := strings.FieldsFunc(v, func(r rune) bool {
151151
return r == ','
152152
})
153-
set.AddStr(fields...)
153+
set.Add(fields...)
154154
}
155-
return set.KeysStr()
155+
return set.Keys()
156156
}
157157

158158
type pattern map[string]struct{}

tools/goctl/model/sql/gen/customized.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,17 @@ func genCustomized(table Table, withCache, postgreSql bool) (string, error) {
6060
fields = append(fields, f)
6161
}
6262

63-
keySet := collection.NewSet()
64-
keyVariableSet := collection.NewSet()
65-
keySet.AddStr(table.PrimaryCacheKey.KeyExpression)
66-
keyVariableSet.AddStr(table.PrimaryCacheKey.KeyLeft)
63+
keySet := collection.NewSet[string]()
64+
keyVariableSet := collection.NewSet[string]()
65+
keySet.Add(table.PrimaryCacheKey.KeyExpression)
66+
keyVariableSet.Add(table.PrimaryCacheKey.KeyLeft)
6767
for _, key := range table.UniqueCacheKey {
68-
keySet.AddStr(key.DataKeyExpression)
69-
keyVariableSet.AddStr(key.KeyLeft)
68+
keySet.Add(key.DataKeyExpression)
69+
keyVariableSet.Add(key.KeyLeft)
7070
}
71-
keys := keySet.KeysStr()
71+
keys := keySet.Keys()
7272
sort.Strings(keys)
73-
keyVars := keyVariableSet.KeysStr()
73+
keyVars := keyVariableSet.Keys()
7474
sort.Strings(keyVars)
7575

7676
camel := table.Name.ToCamel()

tools/goctl/model/sql/gen/delete.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ import (
1212
)
1313

1414
func genDelete(table Table, withCache, postgreSql bool) (string, string, error) {
15-
keySet := collection.NewSet()
16-
keyVariableSet := collection.NewSet()
17-
keySet.AddStr(table.PrimaryCacheKey.KeyExpression)
18-
keyVariableSet.AddStr(table.PrimaryCacheKey.KeyLeft)
15+
keySet := collection.NewSet[string]()
16+
keyVariableSet := collection.NewSet[string]()
17+
keySet.Add(table.PrimaryCacheKey.KeyExpression)
18+
keyVariableSet.Add(table.PrimaryCacheKey.KeyLeft)
1919
for _, key := range table.UniqueCacheKey {
20-
keySet.AddStr(key.DataKeyExpression)
21-
keyVariableSet.AddStr(key.KeyLeft)
20+
keySet.Add(key.DataKeyExpression)
21+
keyVariableSet.Add(key.KeyLeft)
2222
}
23-
keys := keySet.KeysStr()
23+
keys := keySet.Keys()
2424
sort.Strings(keys)
25-
keyVars := keyVariableSet.KeysStr()
25+
keyVars := keyVariableSet.Keys()
2626
sort.Strings(keyVars)
2727

2828
camel := table.Name.ToCamel()

tools/goctl/model/sql/gen/insert.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ import (
1313
)
1414

1515
func genInsert(table Table, withCache, postgreSql bool) (string, string, error) {
16-
keySet := collection.NewSet()
17-
keyVariableSet := collection.NewSet()
18-
keySet.AddStr(table.PrimaryCacheKey.DataKeyExpression)
19-
keyVariableSet.AddStr(table.PrimaryCacheKey.KeyLeft)
16+
keySet := collection.NewSet[string]()
17+
keyVariableSet := collection.NewSet[string]()
18+
keySet.Add(table.PrimaryCacheKey.DataKeyExpression)
19+
keyVariableSet.Add(table.PrimaryCacheKey.KeyLeft)
2020
for _, key := range table.UniqueCacheKey {
21-
keySet.AddStr(key.DataKeyExpression)
22-
keyVariableSet.AddStr(key.KeyLeft)
21+
keySet.Add(key.DataKeyExpression)
22+
keyVariableSet.Add(key.KeyLeft)
2323
}
24-
keys := keySet.KeysStr()
24+
keys := keySet.Keys()
2525
sort.Strings(keys)
26-
keyVars := keyVariableSet.KeysStr()
26+
keyVars := keyVariableSet.Keys()
2727
sort.Strings(keyVars)
2828

2929
expressions := make([]string, 0)

0 commit comments

Comments
 (0)