Bluemage/go/api/api.go

24 lines
362 B
Go
Raw Normal View History

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