b97d9896 by astaxie

update config to change section . to ::

1 parent 690ecb81
...@@ -154,7 +154,7 @@ func (c *IniConfigContainer) Set(key, value string) error { ...@@ -154,7 +154,7 @@ func (c *IniConfigContainer) Set(key, value string) error {
154 154
155 var section, k string 155 var section, k string
156 key = strings.ToLower(key) 156 key = strings.ToLower(key)
157 sectionkey := strings.Split(key, ".") 157 sectionkey := strings.Split(key, "::")
158 if len(sectionkey) >= 2 { 158 if len(sectionkey) >= 2 {
159 section = sectionkey[0] 159 section = sectionkey[0]
160 k = sectionkey[1] 160 k = sectionkey[1]
...@@ -184,7 +184,7 @@ func (c *IniConfigContainer) getdata(key string) string { ...@@ -184,7 +184,7 @@ func (c *IniConfigContainer) getdata(key string) string {
184 184
185 var section, k string 185 var section, k string
186 key = strings.ToLower(key) 186 key = strings.ToLower(key)
187 sectionkey := strings.Split(key, ".") 187 sectionkey := strings.Split(key, "::")
188 if len(sectionkey) >= 2 { 188 if len(sectionkey) >= 2 {
189 section = sectionkey[0] 189 section = sectionkey[0]
190 k = sectionkey[1] 190 k = sectionkey[1]
......
...@@ -69,13 +69,13 @@ func TestIni(t *testing.T) { ...@@ -69,13 +69,13 @@ func TestIni(t *testing.T) {
69 if iniconf.String("name") != "astaxie" { 69 if iniconf.String("name") != "astaxie" {
70 t.Fatal("get name error") 70 t.Fatal("get name error")
71 } 71 }
72 if iniconf.String("demo.key1") != "asta" { 72 if iniconf.String("demo::key1") != "asta" {
73 t.Fatal("get demo.key1 error") 73 t.Fatal("get demo.key1 error")
74 } 74 }
75 if iniconf.String("demo.key2") != "xie" { 75 if iniconf.String("demo::key2") != "xie" {
76 t.Fatal("get demo.key2 error") 76 t.Fatal("get demo.key2 error")
77 } 77 }
78 if v, err := iniconf.Bool("demo.caseinsensitive"); err != nil || v != true { 78 if v, err := iniconf.Bool("demo::caseinsensitive"); err != nil || v != true {
79 t.Fatal("get demo.caseinsensitive error") 79 t.Fatal("get demo.caseinsensitive error")
80 } 80 }
81 } 81 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!