pub struct PostgresSourceBuilder { /* private fields */ }Expand description
Builder for PostgreSQL source configuration.
Provides a fluent API for constructing PostgreSQL source configurations with sensible defaults.
§Example
use drasi_source_postgres::PostgresReplicationSource;
let source = PostgresReplicationSource::builder("pg-source")
.with_host("db.example.com")
.with_database("production")
.with_user("replication_user")
.with_password("secret")
.with_tables(vec!["users".to_string(), "orders".to_string()])
.with_slot_name("my_slot")
.build()?;Implementations§
Source§impl PostgresSourceBuilder
impl PostgresSourceBuilder
Sourcepub fn new(id: impl Into<String>) -> Self
pub fn new(id: impl Into<String>) -> Self
Create a new PostgreSQL source builder with the given ID and default values
Sourcepub fn with_database(self, database: impl Into<String>) -> Self
pub fn with_database(self, database: impl Into<String>) -> Self
Set the database name
Sourcepub fn with_password(self, password: impl Into<String>) -> Self
pub fn with_password(self, password: impl Into<String>) -> Self
Set the database password
Sourcepub fn with_tables(self, tables: Vec<String>) -> Self
pub fn with_tables(self, tables: Vec<String>) -> Self
Set the tables to replicate
Sourcepub fn with_slot_name(self, slot_name: impl Into<String>) -> Self
pub fn with_slot_name(self, slot_name: impl Into<String>) -> Self
Set the replication slot name
Sourcepub fn with_publication_name(self, publication_name: impl Into<String>) -> Self
pub fn with_publication_name(self, publication_name: impl Into<String>) -> Self
Set the publication name
Sourcepub fn with_ssl_mode(self, ssl_mode: SslMode) -> Self
pub fn with_ssl_mode(self, ssl_mode: SslMode) -> Self
Set the SSL mode
Sourcepub fn with_table_keys(self, table_keys: Vec<TableKeyConfig>) -> Self
pub fn with_table_keys(self, table_keys: Vec<TableKeyConfig>) -> Self
Set the table key configurations
Sourcepub fn add_table_key(self, table_key: TableKeyConfig) -> Self
pub fn add_table_key(self, table_key: TableKeyConfig) -> Self
Add a table key configuration
Sourcepub fn with_dispatch_mode(self, mode: DispatchMode) -> Self
pub fn with_dispatch_mode(self, mode: DispatchMode) -> Self
Set the dispatch mode for this source
Sourcepub fn with_dispatch_buffer_capacity(self, capacity: usize) -> Self
pub fn with_dispatch_buffer_capacity(self, capacity: usize) -> Self
Set the dispatch buffer capacity for this source
Sourcepub fn with_bootstrap_provider(
self,
provider: impl BootstrapProvider + 'static,
) -> Self
pub fn with_bootstrap_provider( self, provider: impl BootstrapProvider + 'static, ) -> Self
Set the bootstrap provider for this source
Sourcepub fn with_auto_start(self, auto_start: bool) -> Self
pub fn with_auto_start(self, auto_start: bool) -> Self
Set whether this source should auto-start when DrasiLib starts.
Default is true. Set to false if this source should only be
started manually via start_source().
Sourcepub fn with_config(self, config: PostgresSourceConfig) -> Self
pub fn with_config(self, config: PostgresSourceConfig) -> Self
Set the full configuration at once
Sourcepub fn build(self) -> Result<PostgresReplicationSource>
pub fn build(self) -> Result<PostgresReplicationSource>
Build the PostgreSQL replication source
§Errors
Returns an error if the source cannot be constructed.