Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit abc8991

Browse files
dimrocmattn
authored andcommitted
column types text, varchar, *char return as strings:
As opposed to []byte arrays. This brings sqlite closer in line with other dbs like postgres, allowing downstream consumers to assume the scanned value is string across underlying dbs.
1 parent 3fa1c55 commit abc8991

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
@@ -223,6 +223,7 @@ var SQLiteTimestampFormats = []string{
223223
const (
224224
columnDate string = "date"
225225
columnDatetime string = "datetime"
226+
columnText string = "text"
226227
columnTimestamp string = "timestamp"
227228
)
228229

@@ -2061,10 +2062,15 @@ func (rc *SQLiteRows) Next(dest []driver.Value) error {
20612062
t = t.In(rc.s.c.loc)
20622063
}
20632064
dest[i] = t
2065+
case columnText:
2066+
dest[i] = s
20642067
default:
2065-
dest[i] = []byte(s)
2068+
if strings.Contains(strings.ToLower(rc.decltype[i]), "char") {
2069+
dest[i] = s
2070+
} else {
2071+
dest[i] = []byte(s)
2072+
}
20662073
}
2067-
20682074
}
20692075
}
20702076
return nil

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /