Skip to content
This repository was archived by the owner on Aug 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions write.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ func (r *Row) WriteSlice(e interface{}, cols int) int {
if cell.SetString(``); t.Valid {
cell.SetValue(t.Int64)
}
case sql.NullInt32:
cell := r.AddCell()
if cell.SetString(``); t.Valid {
cell.SetValue(t.Int32)
}
case sql.NullFloat64:
cell := r.AddCell()
if cell.SetString(``); t.Valid {
Expand Down Expand Up @@ -136,6 +141,11 @@ func (r *Row) WriteStruct(e interface{}, cols int) int {
if cell.SetString(``); t.Valid {
cell.SetValue(t.Int64)
}
case sql.NullInt32:
cell := r.AddCell()
if cell.SetString(``); t.Valid {
cell.SetValue(t.Int32)
}
case sql.NullFloat64:
cell := r.AddCell()
if cell.SetString(``); t.Valid {
Expand Down
4 changes: 2 additions & 2 deletions write_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestWrite(t *testing.T) {
Raiting sql.NullFloat64
NullLastName sql.NullString
NullHasPhd sql.NullBool
NullGithubStars sql.NullInt64
NullGithubStars sql.NullInt32
NullRaiting sql.NullFloat64
}
testStruct := e{
Expand All @@ -59,7 +59,7 @@ func TestWrite(t *testing.T) {
sql.NullFloat64{Float64: 0.123, Valid: true},
sql.NullString{String: `What ever`, Valid: false},
sql.NullBool{Bool: true, Valid: false},
sql.NullInt64{Int64: 100, Valid: false},
sql.NullInt32{Int32: 100, Valid: false},
sql.NullFloat64{Float64: 0.123, Valid: false},
}
cnt := row.WriteStruct(&testStruct, -1)
Expand Down
Loading