orbis/internal/app/postgres.go

18 lines
401 B
Go
Raw Normal View History

package app
import (
"fmt"
2025-01-16 13:48:05 +01:00
"git.front.kjuulh.io/kjuulh/orbis/internal/persistence"
"git.front.kjuulh.io/kjuulh/orbis/internal/utilities"
2025-01-17 20:51:50 +01:00
"github.com/jackc/pgx/v5/pgxpool"
)
2025-01-17 20:51:50 +01:00
var Postgres = utilities.Singleton(func() (*pgxpool.Pool, error) {
2025-01-16 13:48:05 +01:00
if err := persistence.Migrate(); err != nil {
return nil, fmt.Errorf("failed to migrate database: %w", err)
}
2025-01-16 13:48:05 +01:00
return persistence.NewConnection()
})