This commit is contained in:
suyl
2021-07-23 14:53:02 +08:00
parent 78a191a0c5
commit a3b287d5e8
2 changed files with 9 additions and 10 deletions

View File

@@ -26,7 +26,7 @@ func Insert(db *sqlx.DB, obj interface{}) (err error) {
}
sname := stype.Name()
sql.WriteString("INSERT INTO ")
for i := 0; i < stype.NumField(); i++ {
for i := 1; i < stype.NumField(); i++ {
if stype.Field(i).Type.String() == "*time.Time" {
if direct.Field(i).Interface().(*time.Time) != nil {
values.WriteString(stype.Field(i).Tag.Get("json") + ",")