1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use crate::{
Result, Rudof,
api::pgschema::PgSchemaOperations,
formats::{InputSpec, PgSchemaFormat},
};
/// Builder for the `load_pg_schema` operation.
pub struct LoadPgSchemaBuilder<'a> {
rudof: &'a mut Rudof,
pg_schema: &'a InputSpec,
pg_schema_format: Option<&'a PgSchemaFormat>,
}
impl<'a> LoadPgSchemaBuilder<'a> {
/// Create a new builder.
///
/// Internal helper called by `Rudof::load_pg_schema()`; not intended for
/// public construction by callers.
pub(crate) fn new(rudof: &'a mut Rudof, pg_schema: &'a InputSpec) -> Self {
Self {
rudof,
pg_schema,
pg_schema_format: None,
}
}
/// Set the format of the input Property Graph schema.
///
/// # Arguments
/// * `pg_schema_format` - The format of the input Property Graph schema (e
pub fn with_pg_schema_format(mut self, pg_schema_format: &'a PgSchemaFormat) -> Self {
self.pg_schema_format = Some(pg_schema_format);
self
}
/// Execute the `load_pg_schema` operation with the configured parameters.
pub fn execute(self) -> Result<()> {
<Rudof as PgSchemaOperations>::load_pgschema(self.rudof, self.pg_schema, self.pg_schema_format)
}
}