Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Eolink
goku-api-gateway
提交
be26ce34
G
goku-api-gateway
项目概览
Eolink
/
goku-api-gateway
上一次同步 1 年多
通知
133
Star
2992
Fork
611
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
goku-api-gateway
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
未验证
提交
be26ce34
编写于
11月 27, 2019
作者:
E
Eolink
提交者:
GitHub
11月 27, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #37 from Dot-Liu/master
修复部分stmt操作没有关闭的问题
上级
72068298
531e16e4
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
19 addition
and
6 deletion
+19
-6
common/database/conn.go
common/database/conn.go
+0
-1
server/dao/console-sqlite3/api.go
server/dao/console-sqlite3/api.go
+2
-0
server/dao/console-sqlite3/apiStrategy.go
server/dao/console-sqlite3/apiStrategy.go
+5
-2
server/dao/console-sqlite3/config-log/log.go
server/dao/console-sqlite3/config-log/log.go
+2
-0
server/dao/console-sqlite3/dao-balance/add.go
server/dao/console-sqlite3/dao-balance/add.go
+3
-0
server/dao/console-sqlite3/dao-service/add.go
server/dao/console-sqlite3/dao-service/add.go
+1
-1
server/dao/console-sqlite3/gateway.go
server/dao/console-sqlite3/gateway.go
+2
-0
server/dao/console-sqlite3/node.go
server/dao/console-sqlite3/node.go
+2
-0
server/dao/console-sqlite3/project.go
server/dao/console-sqlite3/project.go
+1
-0
server/dao/console-sqlite3/strategy.go
server/dao/console-sqlite3/strategy.go
+1
-1
server/dao/console-sqlite3/strategyPlugin.go
server/dao/console-sqlite3/strategyPlugin.go
+0
-1
未找到文件。
common/database/conn.go
浏览文件 @
be26ce34
...
...
@@ -58,7 +58,6 @@ func InitTable() error {
if
err
!=
nil
{
Tx
.
Rollback
()
log
.
Error
(
"InitTable error:"
,
err
,
"
\t
sql:"
,
sql
)
panic
(
err
)
return
err
}
}
...
...
server/dao/console-sqlite3/api.go
浏览文件 @
be26ce34
...
...
@@ -356,6 +356,7 @@ func BatchEditAPIBalance(apiIDList []string, balance string) (string, error) {
if
err
!=
nil
{
return
"[ERROR]Fail to Prepare SQL!"
,
err
}
defer
stmt
.
Close
()
_
,
err
=
stmt
.
Exec
(
now
,
now
,
balance
)
if
err
!=
nil
{
return
"[ERROR]Fail to excute SQL statement!"
,
err
...
...
@@ -375,6 +376,7 @@ func BatchEditAPIGroup(apiIDList []string, groupID int) (string, error) {
if
err
!=
nil
{
return
"[ERROR]Fail to Prepare SQL!"
,
err
}
defer
stmt
.
Close
()
_
,
err
=
stmt
.
Exec
(
now
,
now
,
groupID
)
if
err
!=
nil
{
return
"[ERROR]Fail to excute SQL statement!"
,
err
...
...
server/dao/console-sqlite3/apiStrategy.go
浏览文件 @
be26ce34
...
...
@@ -20,6 +20,9 @@ func AddAPIToStrategy(apiList []string, strategyID string) (bool, string, error)
stmt1
,
_
:=
Tx
.
Prepare
(
sql1
)
stmt2
,
_
:=
Tx
.
Prepare
(
sql2
)
stmt3
,
_
:=
Tx
.
Prepare
(
sql3
)
defer
stmt1
.
Close
()
defer
stmt2
.
Close
()
defer
stmt3
.
Close
()
for
_
,
apiID
:=
range
apiList
{
id
,
err
:=
strconv
.
Atoi
(
apiID
)
...
...
@@ -64,7 +67,7 @@ func SetAPITargetOfStrategy(apiID int, strategyID string, target string) (bool,
if
err
!=
nil
{
return
false
,
err
.
Error
(),
err
}
defer
stmt
.
Close
()
_
,
e
:=
stmt
.
Exec
(
target
,
apiID
,
strategyID
)
if
e
!=
nil
{
...
...
@@ -93,7 +96,7 @@ func BatchSetAPITargetOfStrategy(apiIds []int, strategyID string, target string)
if
err
!=
nil
{
return
false
,
err
.
Error
(),
err
}
defer
stmt
.
Close
()
_
,
e
:=
stmt
.
Exec
(
s
...
)
if
e
!=
nil
{
...
...
server/dao/console-sqlite3/config-log/log.go
浏览文件 @
be26ce34
...
...
@@ -14,6 +14,7 @@ func Get(name string) (*entity.LogConfig, error) {
if
e
!=
nil
{
return
nil
,
e
}
defer
stmt
.
Close
()
ent
:=
&
entity
.
LogConfig
{}
err
:=
stmt
.
QueryRow
(
name
)
.
Scan
(
&
ent
.
Name
,
...
...
@@ -37,6 +38,7 @@ func Set(ent *entity.LogConfig) error {
if
e
!=
nil
{
return
e
}
defer
stmt
.
Close
()
_
,
err
:=
stmt
.
Exec
(
ent
.
Name
,
ent
.
Enable
,
...
...
server/dao/console-sqlite3/dao-balance/add.go
浏览文件 @
be26ce34
...
...
@@ -115,6 +115,7 @@ func Delete(name string) (string, error) {
if
err
!=
nil
{
return
"[ERROR]Illegal SQL statement!"
,
err
}
defer
stmt
.
Close
()
_
,
err
=
stmt
.
Exec
(
name
)
if
err
!=
nil
{
return
"[ERROR]DELETE fail"
,
err
...
...
@@ -132,10 +133,12 @@ func BatchDelete(balanceNames []string) (string, error) {
if
err
!=
nil
{
return
"[ERROR]Illegal SQL statement!"
,
err
}
defer
stmt
.
Close
()
stmt2
,
err
:=
db
.
Prepare
(
sql2
)
if
err
!=
nil
{
return
"[ERROR]Illegal SQL statement!"
,
err
}
defer
stmt2
.
Close
()
for
_
,
balanceName
:=
range
balanceNames
{
stmt
.
Exec
(
balanceName
)
stmt2
.
Exec
(
balanceName
)
...
...
server/dao/console-sqlite3/dao-service/add.go
浏览文件 @
be26ce34
...
...
@@ -17,7 +17,7 @@ func Add(name, driver, desc, config, clusterConfig string, isDefault, healthChec
if
e
!=
nil
{
return
e
}
defer
stmt
.
Close
()
_
,
err
:=
stmt
.
Exec
(
name
,
driver
,
isDefault
,
desc
,
config
,
clusterConfig
,
healthCheck
,
healthCheckPath
,
healthCheckPeriod
,
healthCheckCode
,
healthCheckTimeOut
,
now
,
now
)
return
err
}
server/dao/console-sqlite3/gateway.go
浏览文件 @
be26ce34
...
...
@@ -38,6 +38,7 @@ func EditGatewayBaseConfig(successCode string, nodeUpdatePeriod, monitorUpdatePe
if
err
!=
nil
{
return
false
,
"[ERROR]Illegal SQL Statement!"
,
err
}
defer
stmt
.
Close
()
_
,
err
=
stmt
.
Exec
(
successCode
,
nodeUpdatePeriod
,
monitorUpdatePeriod
,
monitorTimeout
)
if
err
!=
nil
{
return
false
,
"[ERROR]Fail to excute SQL Statement!"
,
err
...
...
@@ -60,6 +61,7 @@ func EditGatewayAlarmConfig(apiAlertInfo, sender, senderPassword, smtpAddress st
if
err
!=
nil
{
return
false
,
"[ERROR]Illegal SQL Statement!"
,
err
}
defer
stmt
.
Close
()
_
,
err
=
stmt
.
Exec
(
apiAlertInfo
,
alertStatus
,
sender
,
senderPassword
,
smtpAddress
,
smtpPort
,
smtpProtocol
)
if
err
!=
nil
{
return
false
,
"[ERROR]Fail to excute SQL Statement!"
,
err
...
...
server/dao/console-sqlite3/node.go
浏览文件 @
be26ce34
...
...
@@ -203,11 +203,13 @@ func UpdateAllNodeClusterID(clusterID int) {
_
,
err
:=
Tx
.
Exec
(
sql
,
clusterID
)
if
err
!=
nil
{
Tx
.
Rollback
()
return
}
sql
=
"UPDATE goku_node_group SET clusterID = ?;"
_
,
err
=
Tx
.
Exec
(
sql
,
clusterID
)
if
err
!=
nil
{
Tx
.
Rollback
()
return
}
Tx
.
Commit
()
}
server/dao/console-sqlite3/project.go
浏览文件 @
be26ce34
...
...
@@ -54,6 +54,7 @@ func DeleteProject(projectID int) (bool, string, error) {
sql
:=
"SELECT groupID FROM goku_gateway_api_group WHERE projectID = ?;"
rows
,
err
:=
Tx
.
Query
(
sql
,
projectID
)
if
err
!=
nil
{
Tx
.
Rollback
()
return
false
,
""
,
err
}
//延时关闭Rows
...
...
server/dao/console-sqlite3/strategy.go
浏览文件 @
be26ce34
...
...
@@ -30,7 +30,7 @@ func AddStrategy(strategyName string, groupID int) (bool, string, error) {
return
false
,
"[ERROR]Empty strategy id !"
,
nil
}
stmt
,
err
:=
db
.
Prepare
(
`INSERT INTO goku_gateway_strategy (strategyID,strategyName,updateTime,createTime,groupID) VALUES (?,?,?,?,?);`
)
defer
stmt
.
Close
()
if
err
!=
nil
{
return
false
,
"[ERROR]Illegal SQL statement!"
,
err
}
...
...
server/dao/console-sqlite3/strategyPlugin.go
浏览文件 @
be26ce34
...
...
@@ -27,7 +27,6 @@ func AddPluginToStrategy(pluginName, config, strategyID string) (bool, interface
result
,
err
:=
Tx
.
Exec
(
"INSERT INTO goku_conn_plugin_strategy (pluginName,pluginConfig,strategyID,createTime,updateTime,pluginStatus) VALUES (?,?,?,?,?,?);"
,
pluginName
,
config
,
strategyID
,
now
,
now
,
1
)
if
err
!=
nil
{
Tx
.
Rollback
()
panic
(
err
)
return
false
,
"[ERROR]Fail to insert data"
,
errors
.
New
(
"[ERROR]Fail to insert data"
)
}
connID
,
err
:=
result
.
LastInsertId
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录