Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 25 for AddError (0.19 sec)

  1. callbacks/create.go

    			)
    			if db.AddError(err) == nil {
    				defer func() {
    					db.AddError(rows.Close())
    				}()
    				gorm.Scan(rows, db, mode)
    			}
    
    			return
    		}
    
    		result, err := db.Statement.ConnPool.ExecContext(
    			db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...,
    		)
    		if err != nil {
    			db.AddError(err)
    			return
    		}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  2. scan.go

    				db.scanIntoStruct(rows, reflectValue, values, fields, joinFields)
    			}
    		default:
    			db.AddError(rows.Scan(dest))
    		}
    	}
    
    	if err := rows.Err(); err != nil && err != db.Error {
    		db.AddError(err)
    	}
    
    	if db.RowsAffected == 0 && db.Statement.RaiseErrorOnNotFound && db.Error == nil {
    		db.AddError(ErrRecordNotFound)
    	}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Apr 26 09:53:11 GMT 2024
    - 9.8K bytes
    - Viewed (0)
  3. callbacks/callmethod.go

    					fc(value.Addr().Interface(), tx)
    				} else {
    					db.AddError(gorm.ErrInvalidValue)
    					return
    				}
    				db.Statement.CurDestIndex++
    			}
    		case reflect.Struct:
    			if db.Statement.ReflectValue.CanAddr() {
    				fc(db.Statement.ReflectValue.Addr().Interface(), tx)
    			} else {
    				db.AddError(gorm.ErrInvalidValue)
    			}
    		}
    	}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 846 bytes
    - Viewed (0)
  4. callbacks/delete.go

    				if db.AddError(err) == nil {
    					db.RowsAffected, _ = result.RowsAffected()
    				}
    
    				return
    			}
    
    			if rows, err := db.Statement.ConnPool.QueryContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...); db.AddError(err) == nil {
    				gorm.Scan(rows, db, mode)
    				db.AddError(rows.Close())
    			}
    		}
    	}
    }
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Feb 25 02:48:23 GMT 2022
    - 5.6K bytes
    - Viewed (0)
  5. finisher_api.go

    		err = ErrInvalidTransaction
    	}
    
    	if err != nil {
    		tx.AddError(err)
    	}
    
    	return tx
    }
    
    // Commit commits the changes in a transaction
    func (db *DB) Commit() *DB {
    	if committer, ok := db.Statement.ConnPool.(TxCommitter); ok && committer != nil && !reflect.ValueOf(committer).IsNil() {
    		db.AddError(committer.Commit())
    	} else {
    		db.AddError(ErrInvalidTransaction)
    	}
    	return db
    }
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  6. callbacks/associations.go

    							fv, _ := ref.PrimaryKey.ValueOf(db.Statement.Context, obj)
    							db.AddError(ref.ForeignKey.Set(db.Statement.Context, joinValue, fv))
    						} else if ref.PrimaryValue != "" {
    							db.AddError(ref.ForeignKey.Set(db.Statement.Context, joinValue, ref.PrimaryValue))
    						} else {
    							fv, _ := ref.PrimaryKey.ValueOf(db.Statement.Context, elem)
    							db.AddError(ref.ForeignKey.Set(db.Statement.Context, joinValue, fv))
    						}
    					}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Apr 11 03:06:13 GMT 2023
    - 14.3K bytes
    - Viewed (0)
  7. callbacks/update.go

    			if db.Statement.Schema.BeforeSave {
    				if i, ok := value.(BeforeSaveInterface); ok {
    					called = true
    					db.AddError(i.BeforeSave(tx))
    				}
    			}
    
    			if db.Statement.Schema.BeforeUpdate {
    				if i, ok := value.(BeforeUpdateInterface); ok {
    					called = true
    					db.AddError(i.BeforeUpdate(tx))
    				}
    			}
    
    			return called
    		})
    	}
    }
    
    // Update update hook
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 05:44:55 GMT 2024
    - 9.4K bytes
    - Viewed (1)
  8. callbacks/preload.go

    			switch reflectFieldValue.Kind() {
    			case reflect.Struct:
    				tx.AddError(rel.Field.Set(tx.Statement.Context, data, elem.Interface()))
    			case reflect.Slice, reflect.Array:
    				if reflectFieldValue.Type().Elem().Kind() == reflect.Ptr {
    					tx.AddError(rel.Field.Set(tx.Statement.Context, data, reflect.Append(reflectFieldValue, elem).Interface()))
    				} else {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  9. callbacks/query.go

    		if !db.DryRun && db.Error == nil {
    			rows, err := db.Statement.ConnPool.QueryContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...)
    			if err != nil {
    				db.AddError(err)
    				return
    			}
    			defer func() {
    				db.AddError(rows.Close())
    			}()
    			gorm.Scan(rows, db, 0)
    		}
    	}
    }
    
    func BuildQuerySQL(db *gorm.DB) {
    	if db.Statement.Schema != nil {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Jan 29 03:34:57 GMT 2024
    - 9.9K bytes
    - Viewed (0)
  10. statement.go

    					stmt.AddError(field.Set(stmt.Context, stmt.ReflectValue.Index(stmt.CurDestIndex), value))
    				}
    			case reflect.Struct:
    				if !stmt.ReflectValue.CanAddr() {
    					stmt.AddError(ErrInvalidValue)
    					return
    				}
    
    				stmt.AddError(field.Set(stmt.Context, stmt.ReflectValue, value))
    			}
    		} else {
    			stmt.AddError(ErrInvalidField)
    		}
    	} else {
    		stmt.AddError(ErrInvalidField)
    	}
    }
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
Back to top