feat: migrate pocketbase to v0.23

This commit is contained in:
Fu Diwei
2025-01-18 05:22:18 +08:00
parent 1568e5a2a7
commit 32f9c95dd0
46 changed files with 632 additions and 674 deletions

View File

@@ -4,14 +4,16 @@ import (
"log/slog"
"sync"
"github.com/pocketbase/dbx"
"github.com/pocketbase/pocketbase"
"github.com/pocketbase/pocketbase/core"
)
var instance *pocketbase.PocketBase
var instance core.App
var intanceOnce sync.Once
func GetApp() *pocketbase.PocketBase {
func GetApp() core.App {
intanceOnce.Do(func() {
instance = pocketbase.NewWithConfig(pocketbase.Config{
HideStartBanner: true,
@@ -21,6 +23,10 @@ func GetApp() *pocketbase.PocketBase {
return instance
}
func GetDB() dbx.Builder {
return GetApp().DB()
}
func GetLogger() *slog.Logger {
return GetApp().Logger()
}