mirror of
https://github.com/lorsanstand/HomeOps-Hub.git
synced 2026-06-21 17:35:16 +03:00
20 lines
343 B
Go
20 lines
343 B
Go
package command_store
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/lorsanstand/HomeOps-Hub/agent/internal/domain"
|
|
)
|
|
|
|
type CommandStore struct {
|
|
mutex sync.RWMutex
|
|
store map[string]*domain.Command
|
|
}
|
|
|
|
func (c *CommandStore) Get(name string) (*domain.Command, bool) {
|
|
c.mutex.RLock()
|
|
function, ok := c.store[name]
|
|
c.mutex.Unlock()
|
|
return function, ok
|
|
}
|