added wildDelete
This commit is contained in:
parent
9f1f7476ab
commit
a944094978
15
db.go
15
db.go
@ -593,6 +593,21 @@ func (t *TableInfo) Delete(record AssRow) error {
|
|||||||
return nil
|
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) {
|
func (t *TableInfo) UpdateOrInsert(record AssRow) (int64, error) {
|
||||||
var id int64
|
var id int64
|
||||||
id = -1
|
id = -1
|
||||||
|
Loading…
Reference in New Issue
Block a user