19 lines
197 B
Go
19 lines
197 B
Go
package api
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/stephenafamo/bob"
|
|
)
|
|
|
|
type API struct {
|
|
mu sync.Mutex
|
|
db bob.Executor
|
|
}
|
|
|
|
func (api *API) lockf(f func()) {
|
|
api.mu.Lock()
|
|
defer api.mu.Unlock()
|
|
f()
|
|
}
|