Address lint issues
This commit is contained in:
		
							parent
							
								
									0fe079686b
								
							
						
					
					
						commit
						c9984634ac
					
				| @ -200,6 +200,7 @@ func (db *DB) FindInBatches(dest interface{}, batchSize int, fc func(tx *DB, bat | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| find: | ||||
| 	for { | ||||
| 		result := queryDB.Limit(batchSize).Find(dest) | ||||
| 		rowsAffected += result.RowsAffected | ||||
| @ -257,8 +258,8 @@ func (db *DB) FindInBatches(dest interface{}, batchSize int, fc func(tx *DB, bat | ||||
| 						f = result.Statement.Schema.PrimaryFields[i] | ||||
| 						primaryValue, zero := f.ValueOf(tx.Statement.Context, resultsValue.Index(resultsValue.Len()-1)) | ||||
| 						if zero { | ||||
| 							tx.AddError(ErrPrimaryKeyRequired) | ||||
| 							break | ||||
| 							tx.AddError(ErrPrimaryKeyRequired) //nolint:typecheck,errcheck,gosec
 | ||||
| 							break find | ||||
| 						} | ||||
| 						orClauses = append(orClauses, clause.Gt{Column: clause.Column{Table: clause.CurrentTable, Name: f.DBName}, Value: primaryValue}) | ||||
| 					} else { | ||||
| @ -267,8 +268,8 @@ func (db *DB) FindInBatches(dest interface{}, batchSize int, fc func(tx *DB, bat | ||||
| 							f = result.Statement.Schema.PrimaryFields[j] | ||||
| 							primaryValue, zero := f.ValueOf(tx.Statement.Context, resultsValue.Index(resultsValue.Len()-1)) | ||||
| 							if zero { | ||||
| 								tx.AddError(ErrPrimaryKeyRequired) | ||||
| 								break | ||||
| 								tx.AddError(ErrPrimaryKeyRequired) //nolint:typecheck,errcheck,gosec
 | ||||
| 								break find | ||||
| 							} | ||||
| 							if j == i { | ||||
| 								// Build current outer column GT clause
 | ||||
| @ -285,7 +286,7 @@ func (db *DB) FindInBatches(dest interface{}, batchSize int, fc func(tx *DB, bat | ||||
| 			} else { | ||||
| 				primaryValue, zero := result.Statement.Schema.PrimaryFields[0].ValueOf(tx.Statement.Context, resultsValue.Index(resultsValue.Len()-1)) | ||||
| 				if zero { | ||||
| 					tx.AddError(ErrPrimaryKeyRequired) | ||||
| 					tx.AddError(ErrPrimaryKeyRequired) //nolint:typecheck,errcheck,gosec
 | ||||
| 					break | ||||
| 				} | ||||
| 				queryDB = tx.Clauses(clause.Gt{Column: clause.Column{Table: clause.CurrentTable, Name: result.Statement.Schema.PrimaryFields[0].DBName}, Value: primaryValue}) | ||||
|  | ||||
							
								
								
									
										19
									
								
								statement.go
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								statement.go
									
									
									
									
									
								
							| @ -112,7 +112,7 @@ func (stmt *Statement) QuoteTo(writer clause.Writer, field interface{}) { | ||||
| 			} else if stmt.Schema.PrimaryFields != nil { | ||||
| 				for idx, s := range stmt.Schema.PrimaryFieldDBNames { | ||||
| 					if idx > 0 { | ||||
| 						writer.WriteByte(',') | ||||
| 						writer.WriteByte(',') //nolint:typecheck,errcheck,gosec
 | ||||
| 					} | ||||
| 					if v.Table != "" { | ||||
| 						if v.Table == clause.CurrentTable { | ||||
| @ -120,7 +120,7 @@ func (stmt *Statement) QuoteTo(writer clause.Writer, field interface{}) { | ||||
| 						} else { | ||||
| 							write(v.Raw, v.Table) | ||||
| 						} | ||||
| 						writer.WriteByte('.') | ||||
| 						writer.WriteByte('.') //nolint:typecheck,errcheck,gosec
 | ||||
| 					} | ||||
| 					write(v.Raw, s) | ||||
| 				} | ||||
| @ -131,7 +131,7 @@ func (stmt *Statement) QuoteTo(writer clause.Writer, field interface{}) { | ||||
| 					} else { | ||||
| 						write(v.Raw, v.Table) | ||||
| 					} | ||||
| 					writer.WriteByte('.') | ||||
| 					writer.WriteByte('.') //nolint:typecheck,errcheck,gosec
 | ||||
| 				} | ||||
| 				write(v.Raw, stmt.Schema.DBNames[0]) | ||||
| 			} else { | ||||
| @ -148,14 +148,15 @@ func (stmt *Statement) QuoteTo(writer clause.Writer, field interface{}) { | ||||
| 			} | ||||
| 
 | ||||
| 			if v.Name == clause.PrimaryKey { | ||||
| 				if stmt.Schema == nil { | ||||
| 					stmt.DB.AddError(ErrModelValueRequired) | ||||
| 				} else if stmt.Schema.PrioritizedPrimaryField != nil { | ||||
| 				switch { | ||||
| 				case stmt.Schema == nil: | ||||
| 					stmt.DB.AddError(ErrModelValueRequired) //nolint:typecheck,errcheck,gosec
 | ||||
| 				case stmt.Schema.PrioritizedPrimaryField != nil: | ||||
| 					write(v.Raw, stmt.Schema.PrioritizedPrimaryField.DBName) | ||||
| 				} else if len(stmt.Schema.DBNames) > 0 { | ||||
| 				case len(stmt.Schema.DBNames) > 0: | ||||
| 					write(v.Raw, stmt.Schema.DBNames[0]) | ||||
| 				} else { | ||||
| 					stmt.DB.AddError(ErrModelAccessibleFieldsRequired) //nolint:typecheck,errcheck
 | ||||
| 				default: | ||||
| 					stmt.DB.AddError(ErrModelAccessibleFieldsRequired) //nolint:typecheck,errcheck,gosec
 | ||||
| 				} | ||||
| 			} else { | ||||
| 				write(v.Raw, v.Name) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Keith Martin
						Keith Martin