Skip to content

Commit 5f70ec6

Browse files
committed
fix(graph): graph data int value
Signed-off-by: monkey <golang@88.com>
1 parent 1dfd4c5 commit 5f70ec6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

graph.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,15 @@ func (d GraphData) String() string {
210210
}
211211

212212
func (d GraphData) Int() int {
213-
if d.typ == graphInteger {
213+
switch d.typ {
214+
case graphInteger:
214215
return int(d.integerVal)
216+
case graphString:
217+
n, _ := strconv.Atoi(d.stringVal)
218+
return n
219+
default:
220+
return 0
215221
}
216-
return 0
217222
}
218223

219224
func (d GraphData) Bool() bool {

0 commit comments

Comments
 (0)