From ad77fbd24eaf501f0ca83e3238850f9b04b7b29b Mon Sep 17 00:00:00 2001 From: kianaza Date: Mon, 20 May 2024 20:07:01 +0330 Subject: [PATCH] fix: Fix some issues caused by merge --- internal/config/config.go | 6 +++--- internal/natsclient/client.go | 23 +++++++++-------------- internal/natsclient/metric.go | 2 +- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index 21ae582..871e3c8 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -24,9 +24,9 @@ const ( type ( // Config holds all configurations. Config struct { - Logger logger.Config `json:"logger,omitempty" koanf:"logger"` - NATS client.Config `json:"nats,omitempty" koanf:"nats"` - Metric metric.Config `json:"metric,omitempty" koanf:"metric"` + Logger logger.Config `json:"logger,omitempty" koanf:"logger"` + NATS natsclient.Config `json:"nats,omitempty" koanf:"nats"` + Metric metric.Config `json:"metric,omitempty" koanf:"metric"` } ) diff --git a/internal/natsclient/client.go b/internal/natsclient/client.go index 254d062..0db4e3c 100644 --- a/internal/natsclient/client.go +++ b/internal/natsclient/client.go @@ -14,12 +14,12 @@ type NatsClient struct { Metrics Metrics } -func New(logger *zap.Logger, cfg Config) *Client { +func New(logger *zap.Logger, cfg Config) *NatsClient { nc := connect(logger, cfg) metrics := NewMetrics() - client := &Client{ + client := &NatsClient{ Conn: nc, Logger: logger, Config: cfg, @@ -56,18 +56,13 @@ func (c *NatsClient) StartMessaging() { go c.Publish("") } -func New(nc *nats.Conn, logger *zap.Logger, cfg Config) *NatsClient { - return &NatsClient{ - Conn: nc, - Logger: logger, - Config: cfg, - } -} - -func (c *NatsClient) StartMessaging() { - go c.Subscribe("") - go c.Publish("") -} +// func New(nc *nats.Conn, logger *zap.Logger, cfg Config) *NatsClient { +// return &NatsClient{ +// Conn: nc, +// Logger: logger, +// Config: cfg, +// } +// } func (c *NatsClient) Publish(subject string) { if subject == "" { diff --git a/internal/natsclient/metric.go b/internal/natsclient/metric.go index a339aeb..0fa1ea7 100644 --- a/internal/natsclient/metric.go +++ b/internal/natsclient/metric.go @@ -1,4 +1,4 @@ -package client +package natsclient import ( "errors"