Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Edadil
MS
model
Commits
4c5016f0
Commit
4c5016f0
authored
1 month ago
by
Шаронов Егор Алексеевич
Browse files
Options
Download
Patches
Plain Diff
fix connection string
parent
39f938ca
master
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
config/config.go
+9
-1
config/config.go
internal/repository/postgres.go
+2
-2
internal/repository/postgres.go
with
11 additions
and
3 deletions
+11
-3
config/config.go
+
9
−
1
View file @
4c5016f0
...
...
@@ -27,7 +27,15 @@ type ServerConfig struct {
}
type
DBConfig
struct
{
Connection
string
`env:"CONNECTION, default=host=localhost user=postgres password=secret dbname=products_db port=5435 sslmode=disable" validate:"required"`
hostname
string
`env:"HOSTNAME, default=localhost"`
port
int
`env:"PORT, default=5435"`
user
string
`env:"USER, default=postgres"`
password
string
`env:"PASSWORD, default=secret"`
dbname
string
`env:"DBNAME, default=products_db"`
}
func
(
c
*
DBConfig
)
ConnectionString
()
string
{
return
fmt
.
Sprintf
(
"host=%s user=%s password=%s dbname=%s port=%d sslmode=disable"
,
c
.
hostname
,
c
.
user
,
c
.
password
,
c
.
dbname
,
c
.
port
)
}
// LLMConfig содержит настройки для работы с LLM (модель, API-ключ, endpoint).
...
...
This diff is collapsed.
Click to expand it.
internal/repository/postgres.go
+
2
−
2
View file @
4c5016f0
...
...
@@ -37,7 +37,7 @@ type storeRepository struct {
}
func
NewStoreRepository
(
cfg
*
config
.
Config
)
(
StoreRepository
,
error
)
{
db
,
err
:=
gorm
.
Open
(
postgres
.
Open
(
cfg
.
DB
.
Connection
),
&
gorm
.
Config
{})
db
,
err
:=
gorm
.
Open
(
postgres
.
Open
(
cfg
.
DB
.
Connection
String
()
),
&
gorm
.
Config
{})
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"failed to connect to DB: %w"
,
err
)
}
...
...
@@ -70,7 +70,7 @@ func (r *storeRepository) GetParsedProductsByAbstractID(ctx context.Context, abs
m.name as market_name,
COALESCE(array_agg(ph.photo_url) FILTER (WHERE ph.photo_url IS NOT NULL), '{}') as photo_urls
FROM parsed_products pp
LEFT JOIN market_categories mc ON mc.category_id = pp.market_categor
ies
_id
LEFT JOIN market_categories mc ON mc.category_id = pp.market_categor
y
_id
LEFT JOIN markets m ON mc.market_id = m.market_id
LEFT JOIN product_photos ph ON ph.parsed_product_id = pp.parsed_product_id
WHERE pp.abstract_product_id = ?
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets