Bluemage/go/api/api.go

28 lines
319 B
Go
Raw Normal View History

2024-08-05 23:06:32 +07:00
package api
import (
"database/sql"
2024-08-05 23:06:32 +07:00
"sync"
"github.com/stephenafamo/bob"
)
type API struct {
mu sync.Mutex
Executor bob.Executor
DB *sql.DB
2024-08-05 23:06:32 +07:00
}
func (api *API) lockf(f func()) {
api.mu.Lock()
defer api.mu.Unlock()
f()
}
type Sort string
const (
SortAsc Sort = "asc"
SortDesc Sort = "desc"
)