created, updated Unix() support
This commit is contained in:
parent
787260824a
commit
7e3812ca28
|
@ -352,6 +352,9 @@ func (engine *Engine) DBMetas() ([]*core.Table, error) {
|
||||||
return tables, nil
|
return tables, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
dump database all table structs and data to a file
|
||||||
|
*/
|
||||||
func (engine *Engine) DumpAllToFile(fp string) error {
|
func (engine *Engine) DumpAllToFile(fp string) error {
|
||||||
f, err := os.Create(fp)
|
f, err := os.Create(fp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -361,6 +364,9 @@ func (engine *Engine) DumpAllToFile(fp string) error {
|
||||||
return engine.DumpAll(f)
|
return engine.DumpAll(f)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
dump database all table structs and data to w
|
||||||
|
*/
|
||||||
func (engine *Engine) DumpAll(w io.Writer) error {
|
func (engine *Engine) DumpAll(w io.Writer) error {
|
||||||
tables, err := engine.DBMetas()
|
tables, err := engine.DBMetas()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -778,6 +784,7 @@ func (engine *Engine) mapType(v reflect.Value) *core.Table {
|
||||||
} else {
|
} else {
|
||||||
col.Nullable = (strings.ToUpper(tags[j-1]) != "NOT")
|
col.Nullable = (strings.ToUpper(tags[j-1]) != "NOT")
|
||||||
}
|
}
|
||||||
|
// TODO: for postgres how add autoincr?
|
||||||
/*case strings.HasPrefix(k, "AUTOINCR(") && strings.HasSuffix(k, ")"):
|
/*case strings.HasPrefix(k, "AUTOINCR(") && strings.HasSuffix(k, ")"):
|
||||||
col.IsAutoIncrement = true
|
col.IsAutoIncrement = true
|
||||||
|
|
||||||
|
@ -1417,6 +1424,8 @@ func (engine *Engine) FormatTime(sqlTypeName string, t time.Time) (v interface{}
|
||||||
} else {
|
} else {
|
||||||
v = engine.TZTime(t).Format(time.RFC3339Nano)
|
v = engine.TZTime(t).Format(time.RFC3339Nano)
|
||||||
}
|
}
|
||||||
|
case core.BigInt, core.Int:
|
||||||
|
v = engine.TZTime(t).Unix()
|
||||||
default:
|
default:
|
||||||
v = engine.TZTime(t)
|
v = engine.TZTime(t)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue