MCPcopy Create free account
hub / github.com/poundifdef/smoothmq / DeleteQueue

Method DeleteQueue

queue/sqlite/sqlite.go:219–247  ·  view source on GitHub ↗
(tenantId int64, queueName string)

Source from the content-addressed store, hash-verified

217}
218
219func (q *SQLiteQueue) DeleteQueue(tenantId int64, queueName string) error {
220 // Delete all messages with the queue, and then the queue itself
221
222 queue, err := q.getQueue(tenantId, queueName)
223 if err != nil {
224 return err
225 }
226
227 q.Mu.Lock()
228 defer q.Mu.Unlock()
229
230 rc := q.DBG.Transaction(func(tx *gorm.DB) error {
231 if err := tx.Where("tenant_id = ? AND queue_id = ?", tenantId, queue.ID).Delete(&KV{}).Error; err != nil {
232 return err
233 }
234
235 if err := tx.Where("tenant_id = ? AND queue_id = ?", tenantId, queue.ID).Delete(&Message{}).Error; err != nil {
236 return err
237 }
238
239 if err := tx.Where("tenant_id = ? AND id = ?", tenantId, queue.ID).Delete(&Queue{}).Error; err != nil {
240 return err
241 }
242
243 return nil
244 })
245
246 return rc
247}
248
249func (q *SQLiteQueue) ListQueues(tenantId int64) ([]string, error) {
250 var queues []Queue

Callers

nothing calls this directly

Calls 2

getQueueMethod · 0.95
DeleteMethod · 0.65

Tested by

no test coverage detected