Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
09aca252
Commit
09aca252
authored
Sep 22, 2013
by
slene
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
orm RegisterDataBase remove default maxIdle/maxConn
parent
beecc507
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
17 deletions
+8
-17
db_alias.go
orm/db_alias.go
+8
-17
No files found.
orm/db_alias.go
View file @
09aca252
...
...
@@ -9,9 +9,6 @@ import (
"time"
)
const
defaultMaxIdleConns
=
30
const
defaultMaxOpenConns
=
50
type
DriverType
int
const
(
...
...
@@ -92,18 +89,6 @@ type alias struct {
// Setting the database connect params. Use the database driver self dataSource args.
func
RegisterDataBase
(
aliasName
,
driverName
,
dataSource
string
,
params
...
int
)
{
maxIdleConns
:=
defaultMaxIdleConns
maxOpenConns
:=
defaultMaxOpenConns
for
i
,
v
:=
range
params
{
switch
i
{
case
0
:
maxIdleConns
=
v
case
1
:
maxOpenConns
=
v
}
}
al
:=
new
(
alias
)
al
.
Name
=
aliasName
al
.
DriverName
=
driverName
...
...
@@ -173,8 +158,14 @@ func RegisterDataBase(aliasName, driverName, dataSource string, params ...int) {
}
}
SetMaxIdleConns
(
al
.
Name
,
maxIdleConns
)
SetMaxOpenConns
(
al
.
Name
,
maxOpenConns
)
for
i
,
v
:=
range
params
{
switch
i
{
case
0
:
SetMaxIdleConns
(
al
.
Name
,
v
)
case
1
:
SetMaxOpenConns
(
al
.
Name
,
v
)
}
}
err
=
al
.
DB
.
Ping
()
if
err
!=
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment