add remove driver function
This commit is contained in:
@@ -16,9 +16,7 @@ func (b *Bus) AddAddress(address ...uint) {
|
||||
}
|
||||
b.Address = append(b.Address, a)
|
||||
slices.Sort(b.Address)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (b *Bus) AddSubscription(sub ...string) {
|
||||
@@ -34,3 +32,25 @@ func (b *Bus) AddPublish(pub ...string) {
|
||||
}
|
||||
b.Topic.AddPublish(pub...)
|
||||
}
|
||||
|
||||
func (b *Bus) RemoveAddress(address ...uint) {
|
||||
if len(b.Address) == 1 {
|
||||
b.Address = []uint{}
|
||||
return
|
||||
}
|
||||
for _, toDelete := range address {
|
||||
for i, a := range b.Address {
|
||||
if a == toDelete {
|
||||
b.Address = slices.Delete(b.Address, i, i+1)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (b *Bus) RemoveSubscription(sub ...string) {
|
||||
b.Topic.RemoveSubscription(sub...)
|
||||
}
|
||||
|
||||
func (b *Bus) RemovePublish(pub ...string) {
|
||||
b.Topic.RemovePublish(pub...)
|
||||
}
|
||||
|
Reference in New Issue
Block a user