optimize value of reflection length (#4152)
This commit is contained in:
		
							parent
							
								
									a3abb5fedf
								
							
						
					
					
						commit
						221d0a0ec1
					
				| @ -35,10 +35,12 @@ func (db *DB) CreateInBatches(value interface{}, batchSize int) (tx *DB) { | ||||
| 		tx = db.getInstance() | ||||
| 
 | ||||
| 		callFc := func(tx *DB) error { | ||||
| 			for i := 0; i < reflectValue.Len(); i += batchSize { | ||||
| 			// the reflection length judgment of the optimized value
 | ||||
| 			reflectLen := reflectValue.Len() | ||||
| 			for i := 0; i < reflectLen; i += batchSize { | ||||
| 				ends := i + batchSize | ||||
| 				if ends > reflectValue.Len() { | ||||
| 					ends = reflectValue.Len() | ||||
| 				if ends > reflectLen { | ||||
| 					ends = reflectLen | ||||
| 				} | ||||
| 
 | ||||
| 				subtx := tx.getInstance() | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 heige
						heige