diff --git a/go/plugins/postgresql/docstore.go b/go/plugins/postgresql/docstore.go index 90f7bda7b9..3c72178694 100644 --- a/go/plugins/postgresql/docstore.go +++ b/go/plugins/postgresql/docstore.go @@ -34,7 +34,7 @@ func newDocStore(ctx context.Context, p *Postgres, cfg *Config) (*DocStore, erro } ds := &DocStore{ - engine: p.engine, + engine: p.Engine, config: cfg, } diff --git a/go/plugins/postgresql/genkit.go b/go/plugins/postgresql/genkit.go index b71d3b0552..8e1a2f733e 100644 --- a/go/plugins/postgresql/genkit.go +++ b/go/plugins/postgresql/genkit.go @@ -31,7 +31,7 @@ const provider = "postgres" type Postgres struct { mu sync.Mutex initted bool - engine *PostgresEngine + Engine *PostgresEngine } func (p *Postgres) Name() string { @@ -46,11 +46,11 @@ func (p *Postgres) Init(ctx context.Context) []api.Action { panic("postgres.Init already initted") } - if p.engine == nil { + if p.Engine == nil { panic("postgres.Init engine is nil") } - if p.engine.Pool == nil { + if p.Engine.Pool == nil { panic("postgres.Init engine has no pool") } @@ -134,7 +134,7 @@ func (p *Postgres) ApplyVectorIndex(ctx context.Context, config *Config, index B stmt := fmt.Sprintf(`CREATE INDEX %s %s ON "%s"."%s" USING %s (%s %s) %s %s`, concurrentlyStr, name, config.SchemaName, config.TableName, index.indexType, config.EmbeddingColumn, function, params, filter) - _, err := p.engine.Pool.Exec(ctx, stmt) + _, err := p.Engine.Pool.Exec(ctx, stmt) if err != nil { return fmt.Errorf("failed to execute creation of index: %w", err) } @@ -157,7 +157,7 @@ func (p *Postgres) ReIndexWithName(ctx context.Context, indexName string) error panic("postgres.ApplyVectorIndex not initted") } query := fmt.Sprintf("REINDEX INDEX %s;", indexName) - _, err := p.engine.Pool.Exec(ctx, query) + _, err := p.Engine.Pool.Exec(ctx, query) if err != nil { return fmt.Errorf("failed to reindex: %w", err) } @@ -174,7 +174,7 @@ func (p *Postgres) DropVectorIndex(ctx context.Context, config *Config, indexNam indexName = config.TableName + defaultIndexNameSuffix } query := fmt.Sprintf("DROP INDEX IF EXISTS %s;", indexName) - _, err := p.engine.Pool.Exec(ctx, query) + _, err := p.Engine.Pool.Exec(ctx, query) if err != nil { return fmt.Errorf("failed to drop vector index: %w", err) } @@ -193,7 +193,7 @@ func (p *Postgres) IsValidIndex(ctx context.Context, config *Config, indexName s query := fmt.Sprintf("SELECT tablename, indexname FROM pg_indexes WHERE tablename = '%s' AND schemaname = '%s' AND indexname = '%s';", config.TableName, config.SchemaName, indexName) var tableName, indexNameFromDB string - if err := p.engine.Pool.QueryRow(ctx, query).Scan(&tableName, &indexNameFromDB); err != nil { + if err := p.Engine.Pool.QueryRow(ctx, query).Scan(&tableName, &indexNameFromDB); err != nil { return false, fmt.Errorf("failed to check if index exists: %w", err) } diff --git a/go/plugins/postgresql/genkit_test.go b/go/plugins/postgresql/genkit_test.go index 29cd5bd958..e03a4647f4 100644 --- a/go/plugins/postgresql/genkit_test.go +++ b/go/plugins/postgresql/genkit_test.go @@ -65,7 +65,7 @@ func TestPostgres(t *testing.T) { } postgres := &Postgres{ - engine: pEngine, + Engine: pEngine, } g := genkit.Init(ctx, genkit.WithPlugins(postgres))