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
37fe175c
Commit
37fe175c
authored
Aug 26, 2014
by
astaxie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #776 from devYu/master
udpate ini.go
parents
fcc9d8c4
ccb61f04
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
ini.go
config/ini.go
+8
-9
No files found.
config/ini.go
View file @
37fe175c
...
...
@@ -147,7 +147,7 @@ type IniConfigContainer struct {
// Bool returns the boolean value for a given key.
func
(
c
*
IniConfigContainer
)
Bool
(
key
string
)
(
bool
,
error
)
{
return
strconv
.
ParseBool
(
c
.
getdata
(
strings
.
ToLower
(
key
)
))
return
strconv
.
ParseBool
(
c
.
getdata
(
key
))
}
// DefaultBool returns the boolean value for a given key.
...
...
@@ -162,7 +162,7 @@ func (c *IniConfigContainer) DefaultBool(key string, defaultval bool) bool {
// Int returns the integer value for a given key.
func
(
c
*
IniConfigContainer
)
Int
(
key
string
)
(
int
,
error
)
{
return
strconv
.
Atoi
(
c
.
getdata
(
strings
.
ToLower
(
key
)
))
return
strconv
.
Atoi
(
c
.
getdata
(
key
))
}
// DefaultInt returns the integer value for a given key.
...
...
@@ -177,7 +177,7 @@ func (c *IniConfigContainer) DefaultInt(key string, defaultval int) int {
// Int64 returns the int64 value for a given key.
func
(
c
*
IniConfigContainer
)
Int64
(
key
string
)
(
int64
,
error
)
{
return
strconv
.
ParseInt
(
c
.
getdata
(
strings
.
ToLower
(
key
)
),
10
,
64
)
return
strconv
.
ParseInt
(
c
.
getdata
(
key
),
10
,
64
)
}
// DefaultInt64 returns the int64 value for a given key.
...
...
@@ -192,7 +192,7 @@ func (c *IniConfigContainer) DefaultInt64(key string, defaultval int64) int64 {
// Float returns the float value for a given key.
func
(
c
*
IniConfigContainer
)
Float
(
key
string
)
(
float64
,
error
)
{
return
strconv
.
ParseFloat
(
c
.
getdata
(
strings
.
ToLower
(
key
)
),
64
)
return
strconv
.
ParseFloat
(
c
.
getdata
(
key
),
64
)
}
// DefaultFloat returns the float64 value for a given key.
...
...
@@ -207,8 +207,7 @@ func (c *IniConfigContainer) DefaultFloat(key string, defaultval float64) float6
// String returns the string value for a given key.
func
(
c
*
IniConfigContainer
)
String
(
key
string
)
string
{
key
=
strings
.
ToLower
(
key
)
return
c
.
getdata
(
strings
.
ToLower
(
key
))
return
c
.
getdata
(
key
)
}
// DefaultString returns the string value for a given key.
...
...
@@ -338,15 +337,15 @@ func (c *IniConfigContainer) DIY(key string) (v interface{}, err error) {
// section.key or key
func
(
c
*
IniConfigContainer
)
getdata
(
key
string
)
string
{
c
.
RLock
()
defer
c
.
RUnlock
()
if
len
(
key
)
==
0
{
return
""
}
c
.
RLock
()
defer
c
.
RUnlock
()
var
(
section
,
k
string
sectionKey
[]
string
=
strings
.
Split
(
key
,
"::"
)
sectionKey
[]
string
=
strings
.
Split
(
strings
.
ToLower
(
key
)
,
"::"
)
)
if
len
(
sectionKey
)
>=
2
{
section
=
sectionKey
[
0
]
...
...
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