Ignore conflicts
This commit is contained in:
8
db.go
8
db.go
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"gorm.io/driver/sqlite"
|
||||
"gorm.io/gorm"
|
||||
"gorm.io/gorm/clause"
|
||||
)
|
||||
|
||||
type DB interface {
|
||||
@@ -39,7 +40,6 @@ func GetDB() (DB, error) {
|
||||
return db, nil
|
||||
}
|
||||
|
||||
|
||||
func (db *DBWrapper) Raw(sql string, args ...any) *gorm.DB {
|
||||
return db.db.Raw(sql, args...)
|
||||
}
|
||||
@@ -49,5 +49,7 @@ func (db *DBWrapper) DB() *gorm.DB {
|
||||
}
|
||||
|
||||
func (db *DBWrapper) SaveKillmails(killmails []Killmail) error {
|
||||
return db.db.CreateInBatches(killmails, 10).Error
|
||||
}
|
||||
return db.db.Session(&gorm.Session{FullSaveAssociations: true}).
|
||||
Clauses(clause.OnConflict{DoNothing: true}).
|
||||
CreateInBatches(killmails, 10).Error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user