This commit is contained in:
angelicatesvara07-crypto
2026-09-22 13:41:56 +07:00
parent 429f01edbc
commit ebe397f096
7 changed files with 67 additions and 11 deletions
+10 -4
View File
@@ -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)
}
}