Skip to content

Commit 4bde157

Browse files
committed
fix all goconst issues
1 parent 28e6f6d commit 4bde157

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

sqlite3.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ var SQLiteTimestampFormats = []string{
141141
"2006-01-02",
142142
}
143143

144+
const (
145+
columnDate string = "date"
146+
columnDatetime string = "datetime"
147+
columnTimestamp string = "timestamp"
148+
)
149+
144150
func init() {
145151
sql.Register("sqlite3", &SQLiteDriver{})
146152
}
@@ -1039,7 +1045,7 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
10391045
case C.SQLITE_INTEGER:
10401046
val := int64(C.sqlite3_column_int64(rc.s.s, C.int(i)))
10411047
switch rc.decltype[i] {
1042-
case "timestamp", "datetime", "date":
1048+
case columnTimestamp, columnDatetime, columnDate:
10431049
var t time.Time
10441050
// Assume a millisecond unix timestamp if it's 13 digits -- too
10451051
// large to be a reasonable timestamp in seconds.
@@ -1086,7 +1092,7 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
10861092
s := C.GoStringN((*C.char)(unsafe.Pointer(C.sqlite3_column_text(rc.s.s, C.int(i)))), C.int(n))
10871093

10881094
switch rc.decltype[i] {
1089-
case "timestamp", "datetime", "date":
1095+
case columnTimestamp, columnDatetime, columnDate:
10901096
var t time.Time
10911097
s = strings.TrimSuffix(s, "Z")
10921098
for _, format := range SQLiteTimestampFormats {

0 commit comments

Comments
 (0)