feat: add migration

This commit is contained in:
2025-01-16 13:48:05 +01:00
parent 703f2ae096
commit a68eae8519
9 changed files with 198 additions and 16 deletions

View File

@@ -0,0 +1,22 @@
package persistence
import (
"context"
"fmt"
"os"
"time"
"github.com/jackc/pgx/v5"
)
func NewConnection() (*pgx.Conn, error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()
conn, err := pgx.Connect(ctx, os.Getenv("ORBIS_POSTGRES_DB"))
if err != nil {
return nil, fmt.Errorf("failed to connect to orbis postgres database: %w", err)
}
return conn, nil
}