1
0
Fork 0
forked from forgejo/forgejo

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:
guillep2k 2019-08-26 23:17:23 -03:00 committed by techknowlogick
parent 541fab196f
commit 5fe2ec264f
39 changed files with 1991 additions and 1404 deletions

View file

@ -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+" ")
}