Skip to content

Commit 8a1e34b

Browse files
committed
update
1 parent f62746c commit 8a1e34b

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

codegen/tml/mainfile/template_main.go

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
const text = `package main
1010
1111
import (
12-
"flag"
1312
"os"
1413
"os/signal"
1514
"sync"

codegen/tml/source/template_source.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ type RedisConfig struct {
6868
Username string $json:"username"$
6969
Passwd string $json:"passwd"$
7070
Addr string $json:"addr"$
71-
Maxopen int $json:"max_open"$ //default 256 //max num of connections can be opened
71+
MaxOpen int $json:"max_open"$ //default 256 //max num of connections can be opened
7272
MaxIdletime ctime.Duration $json:"max_idletime"$ //default 1min //max time a connection can be idle,more then this time,connection will be closed
7373
IoTimeout ctime.Duration $json:"io_timeout"$ //default 500ms
7474
ConnTimeout ctime.Duration $json:"conn_timeout"$ //default 250ms
@@ -81,7 +81,7 @@ type DBConfig struct {
8181
Net string $json:"net"$
8282
Addr string $json:"addr"$
8383
Collation string $json:"collation"$
84-
Maxopen int $json:"max_open"$ //default 256 //max num of connections can be opened
84+
MaxOpen int $json:"max_open"$ //default 256 //max num of connections can be opened
8585
MaxIdletime ctime.Duration $json:"max_idletime"$ //default 1min //max time a connection can be idle,more then this time,connection will be closed
8686
IoTimeout ctime.Duration $json:"io_timeout"$ //default 500ms
8787
ConnTimeout ctime.Duration $json:"conn_timeout"$ //default 250ms
@@ -164,8 +164,8 @@ func (c *sourceConfig) validate() {
164164
dbc.Addr = "127.0.0.1:3306"
165165
dbc.Net = "tcp"
166166
}
167-
if dbc.Maxopen == 0 {
168-
dbc.Maxopen = 100
167+
if dbc.MaxOpen == 0 {
168+
dbc.MaxOpen = 100
169169
}
170170
if dbc.MaxIdletime == 0 {
171171
dbc.MaxIdletime = ctime.Duration(time.Minute * 10)
@@ -181,8 +181,8 @@ func (c *sourceConfig) validate() {
181181
if redisc.Addr == "" {
182182
redisc.Addr = "127.0.0.1:6379"
183183
}
184-
if redisc.Maxopen == 0 {
185-
redisc.Maxopen = 100
184+
if redisc.MaxOpen == 0 {
185+
redisc.MaxOpen = 100
186186
}
187187
if redisc.MaxIdletime == 0 {
188188
redisc.MaxIdletime = ctime.Duration(time.Minute * 10)
@@ -230,9 +230,9 @@ func (c *sourceConfig) newsource() {
230230
Addr :dbc.Addr,
231231
Collation :dbc.Collation,
232232
MaxOpen :dbc.MaxOpen,
233-
MaxIdletime time.Duration(dbc.MaxIdletime),
234-
IOTimeout time.Duration(dbc.IOTimeout),
235-
ConnTimeout time.Duration(dbc.ConnTimeout)
233+
MaxIdletime :time.Duration(dbc.MaxIdletime),
234+
IOTimeout :time.Duration(dbc.IoTimeout),
235+
ConnTimeout :time.Duration(dbc.ConnTimeout),
236236
})
237237
}
238238
caches = make(map[string]*redis.Pool, len(c.Redis))
@@ -244,7 +244,7 @@ func (c *sourceConfig) newsource() {
244244
Username: redisc.Username,
245245
Password: redisc.Passwd,
246246
Addr: redisc.Addr,
247-
MaxOpen: redisc.Maxopen,
247+
MaxOpen: redisc.MaxOpen,
248248
MaxIdletime: time.Duration(redisc.MaxIdletime),
249249
IOTimeout: time.Duration(redisc.IoTimeout),
250250
ConnTimeout: time.Duration(redisc.ConnTimeout),

0 commit comments

Comments
 (0)