fix: correct source type validation for postgres-sql tool (#47)

Fixes a bug introduced in #43 where postgres-tool didn't think any of
the sources were valid.

The root cause of the bug was inconsistent usage of pointer/value in the
receiver functions. The fix updates everything to consistently use a
pointer receiver function.
This commit is contained in:
Kurtis Van Gent
2024-11-05 12:25:21 -07:00
committed by GitHub
parent 621f2c61f9
commit 52ebb431b7
3 changed files with 9 additions and 9 deletions

View File

@@ -56,7 +56,7 @@ func (r Config) Initialize() (sources.Source, error) {
return nil, fmt.Errorf("unable to connect successfully: %w", err)
}
s := Source{
s := &Source{
Name: r.Name,
Kind: SourceKind,
Pool: pool,
@@ -64,7 +64,7 @@ func (r Config) Initialize() (sources.Source, error) {
return s, nil
}
var _ sources.Source = Source{}
var _ sources.Source = &Source{}
type Source struct {
Name string `yaml:"name"`
@@ -72,7 +72,7 @@ type Source struct {
Pool *pgxpool.Pool
}
func (s Source) SourceKind() string {
func (s *Source) SourceKind() string {
return SourceKind
}

View File

@@ -55,7 +55,7 @@ func (r Config) Initialize() (sources.Source, error) {
return nil, fmt.Errorf("unable to connect successfully: %w", err)
}
s := Source{
s := &Source{
Name: r.Name,
Kind: SourceKind,
Pool: pool,
@@ -63,7 +63,7 @@ func (r Config) Initialize() (sources.Source, error) {
return s, nil
}
var _ sources.Source = Source{}
var _ sources.Source = &Source{}
type Source struct {
Name string `yaml:"name"`
@@ -71,7 +71,7 @@ type Source struct {
Pool *pgxpool.Pool
}
func (s Source) SourceKind() string {
func (s *Source) SourceKind() string {
return SourceKind
}

View File

@@ -52,7 +52,7 @@ func (r Config) Initialize() (sources.Source, error) {
return nil, fmt.Errorf("Unable to connect successfully: %w", err)
}
s := Source{
s := &Source{
Name: r.Name,
Kind: SourceKind,
Pool: pool,
@@ -60,7 +60,7 @@ func (r Config) Initialize() (sources.Source, error) {
return s, nil
}
var _ sources.Source = Source{}
var _ sources.Source = &Source{}
type Source struct {
Name string `yaml:"name"`
@@ -68,7 +68,7 @@ type Source struct {
Pool *pgxpool.Pool
}
func (s Source) SourceKind() string {
func (s *Source) SourceKind() string {
return SourceKind
}