Class PostgresEngine
java.lang.Object
dev.langchain4j.community.store.embedding.cloudsql.PostgresEngine
PostgresEngine
Instances of this store are created by configuring a builder: PostgresEngine engine =
new PostgresEngine.Builder(projectId, region, instance, database).build(); Uses HikariCP as a
DataSource. A connection pool that will avoid the latency of repeatedly creating new database
connections.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder which configures and creates instances ofPostgresEngine. -
Constructor Summary
ConstructorsConstructorDescriptionPostgresEngine(PostgresEngine.Builder builder) Constructor for PostgresEngine -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes a ConnectionGets a Connection from the datasourcevoidinitVectorStoreTable(EmbeddingStoreConfig embeddingStoreConfig)
-
Constructor Details
-
PostgresEngine
Constructor for PostgresEngine- Parameters:
builder- builder.
-
-
Method Details
-
getConnection
Gets a Connection from the datasource- Returns:
- A connection with the database specified in
PostgresEngine - Throws:
SQLException- if database error occurs
-
initVectorStoreTable
- Parameters:
embeddingStoreConfig- contains the parameters necesary to intialize the Vector table
-
close
public void close()Closes a Connection
-