mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-01-12 00:49:08 -05:00
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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user