84da1c92 by fuxiaohei

code style simplify

1 parent f733b570
...@@ -57,7 +57,7 @@ type JsonConfigContainer struct { ...@@ -57,7 +57,7 @@ type JsonConfigContainer struct {
57 57
58 // Bool returns the boolean value for a given key. 58 // Bool returns the boolean value for a given key.
59 func (c *JsonConfigContainer) Bool(key string) (bool, error) { 59 func (c *JsonConfigContainer) Bool(key string) (bool, error) {
60 val := c.getdata(key) 60 val := c.getData(key)
61 if val != nil { 61 if val != nil {
62 if v, ok := val.(bool); ok { 62 if v, ok := val.(bool); ok {
63 return v, nil 63 return v, nil
...@@ -69,7 +69,7 @@ func (c *JsonConfigContainer) Bool(key string) (bool, error) { ...@@ -69,7 +69,7 @@ func (c *JsonConfigContainer) Bool(key string) (bool, error) {
69 69
70 // Int returns the integer value for a given key. 70 // Int returns the integer value for a given key.
71 func (c *JsonConfigContainer) Int(key string) (int, error) { 71 func (c *JsonConfigContainer) Int(key string) (int, error) {
72 val := c.getdata(key) 72 val := c.getData(key)
73 if val != nil { 73 if val != nil {
74 if v, ok := val.(float64); ok { 74 if v, ok := val.(float64); ok {
75 return int(v), nil 75 return int(v), nil
...@@ -81,7 +81,7 @@ func (c *JsonConfigContainer) Int(key string) (int, error) { ...@@ -81,7 +81,7 @@ func (c *JsonConfigContainer) Int(key string) (int, error) {
81 81
82 // Int64 returns the int64 value for a given key. 82 // Int64 returns the int64 value for a given key.
83 func (c *JsonConfigContainer) Int64(key string) (int64, error) { 83 func (c *JsonConfigContainer) Int64(key string) (int64, error) {
84 val := c.getdata(key) 84 val := c.getData(key)
85 if val != nil { 85 if val != nil {
86 if v, ok := val.(float64); ok { 86 if v, ok := val.(float64); ok {
87 return int64(v), nil 87 return int64(v), nil
...@@ -93,7 +93,7 @@ func (c *JsonConfigContainer) Int64(key string) (int64, error) { ...@@ -93,7 +93,7 @@ func (c *JsonConfigContainer) Int64(key string) (int64, error) {
93 93
94 // Float returns the float value for a given key. 94 // Float returns the float value for a given key.
95 func (c *JsonConfigContainer) Float(key string) (float64, error) { 95 func (c *JsonConfigContainer) Float(key string) (float64, error) {
96 val := c.getdata(key) 96 val := c.getData(key)
97 if val != nil { 97 if val != nil {
98 if v, ok := val.(float64); ok { 98 if v, ok := val.(float64); ok {
99 return v, nil 99 return v, nil
...@@ -105,7 +105,7 @@ func (c *JsonConfigContainer) Float(key string) (float64, error) { ...@@ -105,7 +105,7 @@ func (c *JsonConfigContainer) Float(key string) (float64, error) {
105 105
106 // String returns the string value for a given key. 106 // String returns the string value for a given key.
107 func (c *JsonConfigContainer) String(key string) string { 107 func (c *JsonConfigContainer) String(key string) string {
108 val := c.getdata(key) 108 val := c.getData(key)
109 if val != nil { 109 if val != nil {
110 if v, ok := val.(string); ok { 110 if v, ok := val.(string); ok {
111 return v 111 return v
...@@ -129,7 +129,7 @@ func (c *JsonConfigContainer) Set(key, val string) error { ...@@ -129,7 +129,7 @@ func (c *JsonConfigContainer) Set(key, val string) error {
129 129
130 // DIY returns the raw value by a given key. 130 // DIY returns the raw value by a given key.
131 func (c *JsonConfigContainer) DIY(key string) (v interface{}, err error) { 131 func (c *JsonConfigContainer) DIY(key string) (v interface{}, err error) {
132 val := c.getdata(key) 132 val := c.getData(key)
133 if val != nil { 133 if val != nil {
134 return val, nil 134 return val, nil
135 } 135 }
...@@ -137,7 +137,7 @@ func (c *JsonConfigContainer) DIY(key string) (v interface{}, err error) { ...@@ -137,7 +137,7 @@ func (c *JsonConfigContainer) DIY(key string) (v interface{}, err error) {
137 } 137 }
138 138
139 // section.key or key 139 // section.key or key
140 func (c *JsonConfigContainer) getdata(key string) interface{} { 140 func (c *JsonConfigContainer) getData(key string) interface{} {
141 c.RLock() 141 c.RLock()
142 defer c.RUnlock() 142 defer c.RUnlock()
143 if len(key) == 0 { 143 if len(key) == 0 {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!