Skip to content

Commit

Permalink
fix: linter
Browse files Browse the repository at this point in the history
  • Loading branch information
3n0ugh committed Sep 9, 2024
1 parent c305178 commit 115f690
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package cdc
import (
"context"
goerrors "errors"
"github.com/Trendyol/go-pq-cdc/pq/timescaledb"
"os"
"os/signal"
"strings"
"syscall"
"time"

"github.com/Trendyol/go-pq-cdc/pq/timescaledb"

"github.com/Trendyol/go-pq-cdc/config"
"github.com/Trendyol/go-pq-cdc/internal/http"
"github.com/Trendyol/go-pq-cdc/internal/metric"
Expand Down Expand Up @@ -38,8 +39,8 @@ type connector struct {
slot *slot.Slot
cancelCh chan os.Signal
readyCh chan struct{}
system pq.IdentifySystemResult
timescaleDB *timescaledb.TimescaleDB
system pq.IdentifySystemResult
}

func NewConnectorWithConfigFile(ctx context.Context, configFilePath string, listenerFunc replication.ListenerFunc) (Connector, error) {
Expand Down
10 changes: 6 additions & 4 deletions pq/timescaledb/hypertable.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ package timescaledb

import (
"context"
goerrors "errors"
"fmt"
"sync"
"time"

"github.com/Trendyol/go-pq-cdc/logger"
"github.com/Trendyol/go-pq-cdc/pq"
"github.com/go-playground/errors"
"github.com/jackc/pgx/v5/pgconn"
"github.com/jackc/pgx/v5/pgtype"
"sync"
"time"
)

var typeMap = pgtype.NewMap()
Expand Down Expand Up @@ -47,7 +49,8 @@ func (tdb *TimescaleDB) FindHyperTables(ctx context.Context) (map[string]string,
resultReader := tdb.conn.Exec(ctx, query)
results, err := resultReader.ReadAll()
if err != nil {
if pgErr, ok := err.(*pgconn.PgError); ok {
var pgErr *pgconn.PgError
if goerrors.As(err, &pgErr) {
if pgErr.Code == "42P01" {
return nil, nil
}
Expand Down Expand Up @@ -101,7 +104,6 @@ func decodeHyperTablesResult(results []*pgconn.Result) (map[string]string, error
case "chunk_name":
chunkName = v.(string)
}

}
res[fmt.Sprintf("%s.%s", chunkSchema, chunkName)] = fmt.Sprintf("%s.%s", hyperSchema, hyperName)
}
Expand Down

0 comments on commit 115f690

Please sign in to comment.