MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / BatchDeleteChannels

Function BatchDeleteChannels

model/channel.go:345–363  ·  view source on GitHub ↗
(ids []int)

Source from the content-addressed store, hash-verified

343}
344
345func BatchDeleteChannels(ids []int) error {
346 //使用事务 删除channel表和channel_ability表
347 tx := DB.Begin()
348 err := tx.Where("id in (?)", ids).Delete(&Channel{}).Error
349 if err != nil {
350 // 回滚事务
351 tx.Rollback()
352 return err
353 }
354 err = tx.Where("channel_id in (?)", ids).Delete(&Ability{}).Error
355 if err != nil {
356 // 回滚事务
357 tx.Rollback()
358 return err
359 }
360 // 提交事务
361 tx.Commit()
362 return err
363}
364
365func (channel *Channel) GetPriority() int64 {
366 if channel.Priority == nil {

Callers 1

DeleteChannelBatchFunction · 0.92

Calls 1

DeleteMethod · 0.45

Tested by

no test coverage detected