first commit

This commit is contained in:
2025-10-06 15:29:51 +07:00
commit a577425a27
11 changed files with 1040 additions and 0 deletions

16
internal/db/postgres.go Normal file
View File

@@ -0,0 +1,16 @@
package db
import (
"database/sql"
"fmt"
_ "github.com/lib/pq"
)
func Connect(host, port, user, password, dbname, sslmode string) (*sql.DB, error) {
dsn := fmt.Sprintf(
"host=%s port=%s user=%s password=%s dbname=%s sslmode=%s",
host, port, user, password, dbname, sslmode,
)
return sql.Open("postgres", dsn)
}