orbis/internal/app/postgres.go

18 lines
389 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"
"github.com/jackc/pgx/v5"
)
var Postgres = utilities.Singleton(func() (*pgx.Conn, 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()
})