tes
This commit is contained in:
+10
-4
@@ -5,12 +5,18 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/jackc/pgx/v5"
|
||||
"5803025024/w04/internal/config"
|
||||
"5803025024/w04/internal/database"
|
||||
|
||||
)
|
||||
|
||||
func main() {
|
||||
// urlExample := "postgres://username:password@localhost:5432/database_name"
|
||||
conn, err := pgx.Connect(context.Background(), os.Getenv("DATABASE_URL"))
|
||||
if err := config.LoadEnv(); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Unable to load env: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
conn, err := database.Connect()
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Unable to connect to database: %v\n", err)
|
||||
os.Exit(1)
|
||||
@@ -26,4 +32,4 @@ func main() {
|
||||
}
|
||||
|
||||
fmt.Println(name, weight)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user