style: prepose error judgement
This commit is contained in:
		
							parent
							
								
									5f019f74bf
								
							
						
					
					
						commit
						6d664a1a0c
					
				@ -51,7 +51,10 @@ func BeforeUpdate(db *gorm.DB) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Update(db *gorm.DB) {
 | 
			
		||||
	if db.Error == nil {
 | 
			
		||||
	if db.Error != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if db.Statement.Schema != nil && !db.Statement.Unscoped {
 | 
			
		||||
		for _, c := range db.Statement.Schema.UpdateClauses {
 | 
			
		||||
			db.Statement.AddClause(c)
 | 
			
		||||
@ -84,7 +87,6 @@ func Update(db *gorm.DB) {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func AfterUpdate(db *gorm.DB) {
 | 
			
		||||
	if db.Error == nil && db.Statement.Schema != nil && !db.Statement.SkipHooks && (db.Statement.Schema.AfterSave || db.Statement.Schema.AfterUpdate) {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user