Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Unsigned Integer and timestamp support #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ func (table *table) Init() error {
func reflectColumnType(tp *sql.ColumnType) reflect.Type {
// reflect for ScanType
switch tp.ScanType().Kind() {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
return reflect.TypeOf(sql.NullInt64{})
case reflect.Float32, reflect.Float64:
return reflect.TypeOf(sql.NullFloat64{})
Expand Down Expand Up @@ -531,6 +531,12 @@ func (table *table) RowBuffer() *bytes.Buffer {
} else {
fmt.Fprintf(&b, "_binary '%s'", sanitize(string(*s)))
}
case *sql.NullTime:
if s.Valid {
fmt.Fprintf(&b, "'%s'", s.Time.Format(time.RFC3339))
} else {
b.WriteString(nullType)
}
default:
fmt.Fprintf(&b, "'%s'", value)
}
Expand Down