Skip to content

Commit 7e0d7e1

Browse files
committed
feat
1 parent 4f2285c commit 7e0d7e1

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

db/conn.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ import (
1111
configuration
1212
db
1313
*/
14+
15+
/*
16+
var (
17+
host = "go_db" string
18+
port = 5432 int
19+
user = "postgres" string
20+
password = "1234" int
21+
dbname = "postgres"
22+
23+
)*/
24+
1425
const (
1526
host = "go_db"
1627
port = 5432
@@ -33,7 +44,7 @@ func ConnectDb() (*sql.DB, error) {
3344
panic(err)
3445
}
3546

36-
fmt.Println("connected to" + dbname)
47+
//fmt.Println("connected to" + dbname)
3748

3849
return db, nil
3950
}

repository/product_repository.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ func (pr *ProductRepository) DeleteProduct(id int) error {
122122

123123
_, err = query.Exec(id)
124124
if err != nil {
125-
fmt.Println(err)
125+
c.JSON(http.StatusUnauthorized, gin.H{"error": err})
126+
//fmt.Println(err)
126127
return err
127128
}
128129

0 commit comments

Comments
 (0)