mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
revert: remove SQLite support
An MMO server without multiplayer defeats the purpose. PostgreSQL is the right choice and Docker Compose already solves the setup pain. This reverts the common/db wrapper, SQLite schema, config Driver field, modernc.org/sqlite dependency, and all repo type changes while keeping the dashboard, wizard, and CI improvements from the previous commit.
This commit is contained in:
@@ -9,8 +9,6 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
dbutil "erupe-ce/common/db"
|
||||
|
||||
"github.com/gorilla/handlers"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/jmoiron/sqlx"
|
||||
@@ -48,11 +46,10 @@ func NewAPIServer(config *Config) *APIServer {
|
||||
httpServer: &http.Server{},
|
||||
}
|
||||
if config.DB != nil {
|
||||
wdb := dbutil.Wrap(config.DB)
|
||||
s.userRepo = NewAPIUserRepository(wdb)
|
||||
s.charRepo = NewAPICharacterRepository(wdb)
|
||||
s.sessionRepo = NewAPISessionRepository(wdb)
|
||||
s.eventRepo = NewAPIEventRepository(wdb)
|
||||
s.userRepo = NewAPIUserRepository(config.DB)
|
||||
s.charRepo = NewAPICharacterRepository(config.DB)
|
||||
s.sessionRepo = NewAPISessionRepository(config.DB)
|
||||
s.eventRepo = NewAPIEventRepository(config.DB)
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
@@ -3,16 +3,16 @@ package api
|
||||
import (
|
||||
"context"
|
||||
|
||||
dbutil "erupe-ce/common/db"
|
||||
"github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
||||
// APICharacterRepository implements APICharacterRepo with PostgreSQL.
|
||||
type APICharacterRepository struct {
|
||||
db *dbutil.DB
|
||||
db *sqlx.DB
|
||||
}
|
||||
|
||||
// NewAPICharacterRepository creates a new APICharacterRepository.
|
||||
func NewAPICharacterRepository(db *dbutil.DB) *APICharacterRepository {
|
||||
func NewAPICharacterRepository(db *sqlx.DB) *APICharacterRepository {
|
||||
return &APICharacterRepository{db: db}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,15 +6,15 @@ import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
dbutil "erupe-ce/common/db"
|
||||
"github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
||||
type apiEventRepository struct {
|
||||
db *dbutil.DB
|
||||
db *sqlx.DB
|
||||
}
|
||||
|
||||
// NewAPIEventRepository creates an APIEventRepo backed by PostgreSQL.
|
||||
func NewAPIEventRepository(db *dbutil.DB) APIEventRepo {
|
||||
func NewAPIEventRepository(db *sqlx.DB) APIEventRepo {
|
||||
return &apiEventRepository{db: db}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,16 +3,16 @@ package api
|
||||
import (
|
||||
"context"
|
||||
|
||||
dbutil "erupe-ce/common/db"
|
||||
"github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
||||
// APISessionRepository implements APISessionRepo with PostgreSQL.
|
||||
type APISessionRepository struct {
|
||||
db *dbutil.DB
|
||||
db *sqlx.DB
|
||||
}
|
||||
|
||||
// NewAPISessionRepository creates a new APISessionRepository.
|
||||
func NewAPISessionRepository(db *dbutil.DB) *APISessionRepository {
|
||||
func NewAPISessionRepository(db *sqlx.DB) *APISessionRepository {
|
||||
return &APISessionRepository{db: db}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,16 +4,16 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
dbutil "erupe-ce/common/db"
|
||||
"github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
||||
// APIUserRepository implements APIUserRepo with PostgreSQL.
|
||||
type APIUserRepository struct {
|
||||
db *dbutil.DB
|
||||
db *sqlx.DB
|
||||
}
|
||||
|
||||
// NewAPIUserRepository creates a new APIUserRepository.
|
||||
func NewAPIUserRepository(db *dbutil.DB) *APIUserRepository {
|
||||
func NewAPIUserRepository(db *sqlx.DB) *APIUserRepository {
|
||||
return &APIUserRepository{db: db}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user