added wildDelete

This commit is contained in:
ycc 2023-09-29 09:30:38 +02:00
parent 9f1f7476ab
commit a944094978
1 changed files with 15 additions and 0 deletions

15
db.go
View File

@ -593,6 +593,21 @@ func (t *TableInfo) Delete(record AssRow) error {
return nil
}
func (t *TableInfo) WildDelete(restriction string) error {
query := ("DELETE FROM " + t.Name + " WHERE " + restriction)
if t.db.LogQueries {
log.Info().Msg(query)
}
rows, err := t.db.conn.Query(query)
if err != nil {
log.Error().Msg(query)
log.Error().Msg(err.Error())
return err
}
defer rows.Close()
return nil
}
func (t *TableInfo) UpdateOrInsert(record AssRow) (int64, error) {
var id int64
id = -1