Skip to content

Commit b82b182

Browse files
committed
fix(storage): mapstructure and json tag colocation
1 parent f6ecc8c commit b82b182

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

pkg/storage/postgres/postgres.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ type storage struct {
1919
// config is the struct contains config for connect client
2020
// Run is made from internal caller
2121
type config struct {
22-
DatabaseURL valuable.Valuable `json:"databaseUrl"`
23-
TableName string `json:"tableName"`
24-
DataField string `json:"dataField"`
22+
DatabaseURL valuable.Valuable `mapstructure:"databaseUrl" json:"databaseUrl"`
23+
TableName string `mapstructure:"tableName" json:"tableName"`
24+
DataField string `mapstructure:"dataField" json:"dataField"`
2525
}
2626

2727
// NewStorage is the function for create new Postgres client storage

pkg/storage/rabbitmq/rabbitmq.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ type storage struct {
2121
// config is the struct contains config for connect client
2222
// Run is made from internal caller
2323
type config struct {
24-
DatabaseURL valuable.Valuable `json:"databaseUrl"`
25-
QueueName string `json:"queueName"`
26-
DefinedContentType string `json:"contentType"`
27-
Durable bool `json:"durable"`
28-
DeleteWhenUnused bool `json:"deleteWhenUnused"`
29-
Exclusive bool `json:"exclusive"`
30-
NoWait bool `json:"noWait"`
31-
Mandatory bool `json:"mandatory"`
32-
Immediate bool `json:"immediate"`
33-
Exchange string `json:"exchange"`
24+
DatabaseURL valuable.Valuable `mapstructure:"databaseUrl" json:"databaseUrl"`
25+
QueueName string `mapstructure:"queueName" json:"queueName"`
26+
DefinedContentType string `mapstructure:"contentType" json:"contentType"`
27+
Durable bool `mapstructure:"durable" json:"durable"`
28+
DeleteWhenUnused bool `mapstructure:"deleteWhenUnused" json:"deleteWhenUnused"`
29+
Exclusive bool `mapstructure:"exclusive" json:"exclusive"`
30+
NoWait bool `mapstructure:"noWait" json:"noWait"`
31+
Mandatory bool `mapstructure:"mandatory" json:"mandatory"`
32+
Immediate bool `mapstructure:"immediate" json:"immediate"`
33+
Exchange string `mapstructure:"exchange" json:"exchange"`
3434
}
3535

3636
// ContentType is the function for get content type used to push data in the

pkg/storage/redis/redis.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ type storage struct {
1616
}
1717

1818
type config struct {
19-
Host string `json:"host"`
20-
Port string `json:"port"`
21-
Database int `json:"database"`
22-
Username valuable.Valuable `json:"username"`
23-
Password valuable.Valuable `json:"password"`
24-
Key string `json:"key"`
19+
Host string `mapstructure:"host" json:"host"`
20+
Port string `mapstructure:"port" json:"port"`
21+
Database int `mapstructure:"database" json:"database"`
22+
Username valuable.Valuable `mapstructure:"username" json:"username"`
23+
Password valuable.Valuable `mapstructure:"password" json:"password"`
24+
Key string `mapstructure:"key" json:"key"`
2525
}
2626

2727
// NewStorage is the function for create new Redis storage client

0 commit comments

Comments
 (0)