mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Retry create issue to cope with duplicate keys (#7898)
* Retry create issue to cope with duplicate keys * Use .SetExpr().Where().Insert()
This commit is contained in:
		
				
					committed by
					
						
						techknowlogick
					
				
			
			
				
	
			
			
			
						parent
						
							541fab196f
						
					
				
				
					commit
					5fe2ec264f
				
			
							
								
								
									
										23
									
								
								vendor/github.com/go-xorm/xorm/helpers.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										23
									
								
								vendor/github.com/go-xorm/xorm/helpers.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -281,7 +281,7 @@ func rValue(bean interface{}) reflect.Value {
 | 
			
		||||
 | 
			
		||||
func rType(bean interface{}) reflect.Type {
 | 
			
		||||
	sliceValue := reflect.Indirect(reflect.ValueOf(bean))
 | 
			
		||||
	//return reflect.TypeOf(sliceValue.Interface())
 | 
			
		||||
	// return reflect.TypeOf(sliceValue.Interface())
 | 
			
		||||
	return sliceValue.Type()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -309,3 +309,24 @@ func sliceEq(left, right []string) bool {
 | 
			
		||||
func indexName(tableName, idxName string) string {
 | 
			
		||||
	return fmt.Sprintf("IDX_%v_%v", tableName, idxName)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func eraseAny(value string, strToErase ...string) string {
 | 
			
		||||
	if len(strToErase) == 0 {
 | 
			
		||||
		return value
 | 
			
		||||
	}
 | 
			
		||||
	var replaceSeq []string
 | 
			
		||||
	for _, s := range strToErase {
 | 
			
		||||
		replaceSeq = append(replaceSeq, s, "")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	replacer := strings.NewReplacer(replaceSeq...)
 | 
			
		||||
 | 
			
		||||
	return replacer.Replace(value)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func quoteColumns(cols []string, quoteFunc func(string) string, sep string) string {
 | 
			
		||||
	for i := range cols {
 | 
			
		||||
		cols[i] = quoteFunc(cols[i])
 | 
			
		||||
	}
 | 
			
		||||
	return strings.Join(cols, sep+" ")
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user