upgrade from go-pg to bun

This commit is contained in:
dhax 2024-08-31 18:57:54 +02:00
parent f59f129354
commit 1886be62bc
23 changed files with 415 additions and 385 deletions

View file

@ -5,9 +5,9 @@ import (
"net/http"
"github.com/sirupsen/logrus"
"github.com/uptrace/bun"
"github.com/go-chi/chi/v5"
"github.com/go-pg/pg"
"github.com/dhax/go-base/auth/authorize"
"github.com/dhax/go-base/database"
@ -30,8 +30,7 @@ type API struct {
}
// NewAPI configures and returns admin application API.
func NewAPI(db *pg.DB) (*API, error) {
func NewAPI(db *bun.DB) (*API, error) {
accountStore := database.NewAdmAccountStore(db)
accounts := NewAccountResource(accountStore)

View file

@ -82,8 +82,7 @@ func New(enableCORS bool) (*chi.Mux, error) {
w.Write([]byte("pong"))
})
client := "./public"
r.Get("/*", SPAHandler(client))
r.Get("/*", SPAHandler("public"))
return r, nil
}

View file

@ -5,8 +5,8 @@ import (
"net/http"
"github.com/go-chi/chi/v5"
"github.com/go-pg/pg"
"github.com/sirupsen/logrus"
"github.com/uptrace/bun"
"github.com/dhax/go-base/database"
"github.com/dhax/go-base/logging"
@ -26,7 +26,7 @@ type API struct {
}
// NewAPI configures and returns application API.
func NewAPI(db *pg.DB) (*API, error) {
func NewAPI(db *bun.DB) (*API, error) {
accountStore := database.NewAccountStore(db)
account := NewAccountResource(accountStore)