More state management for portals

This commit is contained in:
Gary Kramlich
2022-01-31 05:36:08 -06:00
parent c1bb55d3cf
commit 6607e773a6
3 changed files with 136 additions and 5 deletions

View File

@@ -68,3 +68,11 @@ func (p *Portal) Update() {
p.log.Warnfln("Failed to update %s: %v", p.Key, err)
}
}
func (p *Portal) Delete() {
query := "DELETE FROM portal WHERE channel_id=$1 AND receiver=$2"
_, err := p.db.Exec(query, p.Key.ChannelID, p.Key.Receiver)
if err != nil {
p.log.Warnfln("Failed to delete %s: %v", p.Key, err)
}
}