2024-08-05 23:06:32 +07:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
2024-08-13 14:26:19 +07:00
|
|
|
"database/sql"
|
2024-08-05 23:06:32 +07:00
|
|
|
"sync"
|
|
|
|
|
|
|
|
"github.com/stephenafamo/bob"
|
|
|
|
)
|
|
|
|
|
|
|
|
type API struct {
|
2024-08-13 09:40:02 +07:00
|
|
|
mu sync.Mutex
|
|
|
|
Executor bob.Executor
|
2024-08-13 14:26:19 +07:00
|
|
|
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()
|
|
|
|
}
|
2024-08-15 10:23:56 +07:00
|
|
|
|
|
|
|
type Sort string
|
|
|
|
|
|
|
|
const (
|
|
|
|
SortAsc Sort = "asc"
|
|
|
|
SortDesc Sort = "desc"
|
|
|
|
)
|