From a944094978fd0eb82a3b9dded390c4e96619112b Mon Sep 17 00:00:00 2001 From: ycc Date: Fri, 29 Sep 2023 09:30:38 +0200 Subject: [PATCH] added wildDelete --- db.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/db.go b/db.go index 0e674af..946ab9a 100755 --- a/db.go +++ b/db.go @@ -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