Bluemage/go/api/api.go
Tigor Hutasuhut cf14079f1f refactor: api now uses it's own request type and handlers
will now handles the conversion of the request to the api request type
2024-08-15 10:23:56 +07:00

28 lines
319 B
Go

package api
import (
"database/sql"
"sync"
"github.com/stephenafamo/bob"
)
type API struct {
mu sync.Mutex
Executor bob.Executor
DB *sql.DB
}
func (api *API) lockf(f func()) {
api.mu.Lock()
defer api.mu.Unlock()
f()
}
type Sort string
const (
SortAsc Sort = "asc"
SortDesc Sort = "desc"
)