- rename Go module, binary, systemd unit, PG_DATABASE default, frontend package and docs from shared-album to galo - add theme-aware halo emblem and favicon (new ui-branding capability) - add make build-release (versioned, stripped, static binary) and run the binary from the repo root
60 lines
1.7 KiB
Go
60 lines
1.7 KiB
Go
// Package store builds the per-domain metadata repositories for a chosen
|
|
// backend. Domains depend on their Repository interfaces; this factory is the
|
|
// single place that knows the concrete implementations.
|
|
package store
|
|
|
|
import (
|
|
"database/sql"
|
|
|
|
"github.com/jackc/pgx/v5/pgxpool"
|
|
|
|
"galo/internal/albums"
|
|
"galo/internal/auth"
|
|
"galo/internal/members"
|
|
"galo/internal/notifications"
|
|
"galo/internal/photos"
|
|
"galo/internal/settings"
|
|
"galo/internal/sharelinks"
|
|
"galo/internal/social"
|
|
)
|
|
|
|
// Repos bundles one repository per domain.
|
|
type Repos struct {
|
|
Auth auth.Repository
|
|
Albums albums.Repository
|
|
Members members.Repository
|
|
Photos photos.Repository
|
|
Social social.Repository
|
|
Notifications notifications.Repository
|
|
ShareLinks sharelinks.Repository
|
|
Settings settings.Repository
|
|
}
|
|
|
|
// NewPostgres builds the repositories backed by PostgreSQL.
|
|
func NewPostgres(pool *pgxpool.Pool) Repos {
|
|
return Repos{
|
|
Auth: auth.NewStore(pool),
|
|
Albums: albums.NewStore(pool),
|
|
Members: members.NewStore(pool),
|
|
Photos: photos.NewStore(pool),
|
|
Social: social.NewStore(pool),
|
|
Notifications: notifications.NewStore(pool),
|
|
ShareLinks: sharelinks.NewStore(pool),
|
|
Settings: settings.NewStore(pool),
|
|
}
|
|
}
|
|
|
|
// NewSQLite builds the repositories backed by SQLite.
|
|
func NewSQLite(db *sql.DB) Repos {
|
|
return Repos{
|
|
Auth: auth.NewSQLiteStore(db),
|
|
Albums: albums.NewSQLiteStore(db),
|
|
Members: members.NewSQLiteStore(db),
|
|
Photos: photos.NewSQLiteStore(db),
|
|
Social: social.NewSQLiteStore(db),
|
|
Notifications: notifications.NewSQLiteStore(db),
|
|
ShareLinks: sharelinks.NewSQLiteStore(db),
|
|
Settings: settings.NewSQLiteStore(db),
|
|
}
|
|
}
|