Skip to content

Commit 171639d

Browse files
committed
fix DBData scan
1 parent 33b2b2c commit 171639d

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
qsql is a supplement to the go sql package
2+
13
# Refere to:
24
```
35
database/sql

struct.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"database/sql/driver"
66
"fmt"
77
"reflect"
8+
"strconv"
89
"strings"
910
"time"
1011

@@ -85,9 +86,9 @@ func (d *DBData) Scan(i interface{}) error {
8586
}
8687
switch i.(type) {
8788
case int64:
88-
*d = DBData(fmt.Sprintf("%d", i))
89+
*d = DBData(strconv.FormatInt(i.(int64), 10))
8990
case float64:
90-
*d = DBData(fmt.Sprint(i))
91+
*d = DBData(strconv.FormatFloat(i.(float64), 'f', -1, 64))
9192
case []byte:
9293
*d = DBData(string(i.([]byte)))
9394
case string:

0 commit comments

Comments
 (0)