2024-08-05 23:06:32 +07:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
|
|
|
"sync"
|
|
|
|
|
|
|
|
"github.com/stephenafamo/bob"
|
2024-08-08 20:39:04 +07:00
|
|
|
"github.com/tigorlazuardi/bluemage/go/gen/converter"
|
2024-08-05 23:06:32 +07:00
|
|
|
)
|
|
|
|
|
2024-08-08 20:39:04 +07:00
|
|
|
var convert converter.DeviceConverterImpl
|
|
|
|
|
2024-08-05 23:06:32 +07:00
|
|
|
type API struct {
|
|
|
|
mu sync.Mutex
|
2024-08-06 22:13:37 +07:00
|
|
|
DB bob.Executor
|
2024-08-05 23:06:32 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
func (api *API) lockf(f func()) {
|
|
|
|
api.mu.Lock()
|
|
|
|
defer api.mu.Unlock()
|
|
|
|
f()
|
|
|
|
}
|