Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go/plugins/postgresql/docstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down
14 changes: 7 additions & 7 deletions go/plugins/postgresql/genkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const provider = "postgres"
type Postgres struct {
mu sync.Mutex
initted bool
engine *PostgresEngine
Engine *PostgresEngine
}

func (p *Postgres) Name() string {
Expand All @@ -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")
}

Expand Down Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion go/plugins/postgresql/genkit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestPostgres(t *testing.T) {
}

postgres := &Postgres{
engine: pEngine,
Engine: pEngine,
}

g := genkit.Init(ctx, genkit.WithPlugins(postgres))
Expand Down
Loading