install 直接返回error

This commit is contained in:
baichou
2022-06-16 18:14:06 +08:00
parent 6a0e1e1d3d
commit 7eca7783e6
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -89,8 +89,8 @@ func (orm *OrmMysqlTableName) Exec(sql string, values ...interface{}) *gorm.DB {
// ------------ 以下是单表独有的函数, 便捷字段条件, Laravel风格操作 ---------
func (orm *OrmMysqlTableName) Insert(row *MysqlTableName) *gorm.DB {
return orm.db.Create(row)
func (orm *OrmMysqlTableName) Insert(row *MysqlTableName) error {
return orm.db.Create(row).Error
}
func (orm *OrmMysqlTableName) Inserts(rows []*MysqlTableName) *gorm.DB {
+2 -2
View File
@@ -89,8 +89,8 @@ func (orm *Orm{orm_table_name}) Exec(sql string, values ...interface{}) *gorm.DB
// ------------ 以下是单表独有的函数, 便捷字段条件, Laravel风格操作 ---------
func (orm *Orm{orm_table_name}) Insert(row *{orm_table_name}) *gorm.DB {
return orm.db.Create(row)
func (orm *Orm{orm_table_name}) Insert(row *{orm_table_name}) error {
return orm.db.Create(row).Error
}
func (orm *Orm{orm_table_name}) Inserts(rows []*{orm_table_name}) *gorm.DB {