add remove driver function
This commit is contained in:
@@ -27,3 +27,31 @@ func (t *Topic) AddPublish(pubs ...string) {
|
||||
slices.Sort(t.Publish)
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Topic) RemoveSubscription(subs ...string) {
|
||||
if len(t.Subscribe) == 1 {
|
||||
t.Subscribe = []string{}
|
||||
return
|
||||
}
|
||||
for _, toDelete := range subs {
|
||||
for i, a := range t.Subscribe {
|
||||
if a == toDelete {
|
||||
t.Subscribe = slices.Delete(t.Subscribe, i, i+1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Topic) RemovePublish(pubs ...string) {
|
||||
if len(t.Publish) == 1 {
|
||||
t.Publish = []string{}
|
||||
return
|
||||
}
|
||||
for _, toDelete := range pubs {
|
||||
for i, a := range t.Publish {
|
||||
if a == toDelete {
|
||||
t.Publish = slices.Delete(t.Publish, i, i+1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user