@@ -141,6 +141,12 @@ var SQLiteTimestampFormats = []string{
141
141
"2006-01-02" ,
142
142
}
143
143
144
+ const (
145
+ columnDate string = "date"
146
+ columnDatetime string = "datetime"
147
+ columnTimestamp string = "timestamp"
148
+ )
149
+
144
150
func init () {
145
151
sql .Register ("sqlite3" , & SQLiteDriver {})
146
152
}
@@ -1039,7 +1045,7 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
1039
1045
case C .SQLITE_INTEGER :
1040
1046
val := int64 (C .sqlite3_column_int64 (rc .s .s , C .int (i )))
1041
1047
switch rc .decltype [i ] {
1042
- case "timestamp" , "datetime" , "date" :
1048
+ case columnTimestamp , columnDatetime , columnDate :
1043
1049
var t time.Time
1044
1050
// Assume a millisecond unix timestamp if it's 13 digits -- too
1045
1051
// large to be a reasonable timestamp in seconds.
@@ -1086,7 +1092,7 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
1086
1092
s := C .GoStringN ((* C .char )(unsafe .Pointer (C .sqlite3_column_text (rc .s .s , C .int (i )))), C .int (n ))
1087
1093
1088
1094
switch rc .decltype [i ] {
1089
- case "timestamp" , "datetime" , "date" :
1095
+ case columnTimestamp , columnDatetime , columnDate :
1090
1096
var t time.Time
1091
1097
s = strings .TrimSuffix (s , "Z" )
1092
1098
for _ , format := range SQLiteTimestampFormats {
0 commit comments