Skip to content
This repository was archived by the owner on Sep 7, 2021. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

Commit c360c20

Browse files
committed
dump support bool
1 parent 263f9d3 commit c360c20

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

engine.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,18 @@ func (engine *Engine) dumpTables(tables []*core.Table, w io.Writer, tp ...core.D
488488
switch reflect.TypeOf(d).Kind() {
489489
case reflect.Slice:
490490
temp += fmt.Sprintf(", %s", string(d.([]byte)))
491+
case reflect.Int16, reflect.Int8, reflect.Int32, reflect.Int64, reflect.Int:
492+
if col.SQLType.Name == core.Bool {
493+
temp += fmt.Sprintf(", %v", strconv.FormatBool(reflect.ValueOf(d).Int() > 0))
494+
} else {
495+
temp += fmt.Sprintf(", %v", d)
496+
}
497+
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
498+
if col.SQLType.Name == core.Bool {
499+
temp += fmt.Sprintf(", %v", strconv.FormatBool(reflect.ValueOf(d).Uint() > 0))
500+
} else {
501+
temp += fmt.Sprintf(", %v", d)
502+
}
491503
default:
492504
temp += fmt.Sprintf(", %v", d)
493505
}

0 commit comments

Comments
 (0)