mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00: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
4
vendor/xorm.io/core/db.go
generated
vendored
4
vendor/xorm.io/core/db.go
generated
vendored
@@ -15,6 +15,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// DefaultCacheSize sets the default cache size
|
||||
DefaultCacheSize = 200
|
||||
)
|
||||
|
||||
@@ -132,6 +133,7 @@ func (db *DB) Query(query string, args ...interface{}) (*Rows, error) {
|
||||
return db.QueryContext(context.Background(), query, args...)
|
||||
}
|
||||
|
||||
// QueryMapContext executes query with parameters via map and context
|
||||
func (db *DB) QueryMapContext(ctx context.Context, query string, mp interface{}) (*Rows, error) {
|
||||
query, args, err := MapToSlice(query, mp)
|
||||
if err != nil {
|
||||
@@ -140,6 +142,7 @@ func (db *DB) QueryMapContext(ctx context.Context, query string, mp interface{})
|
||||
return db.QueryContext(ctx, query, args...)
|
||||
}
|
||||
|
||||
// QueryMap executes query with parameters via map
|
||||
func (db *DB) QueryMap(query string, mp interface{}) (*Rows, error) {
|
||||
return db.QueryMapContext(context.Background(), query, mp)
|
||||
}
|
||||
@@ -196,6 +199,7 @@ var (
|
||||
re = regexp.MustCompile(`[?](\w+)`)
|
||||
)
|
||||
|
||||
// ExecMapContext exec map with context.Context
|
||||
// insert into (name) values (?)
|
||||
// insert into (name) values (?name)
|
||||
func (db *DB) ExecMapContext(ctx context.Context, query string, mp interface{}) (sql.Result, error) {
|
||||
|
Reference in New Issue
Block a user