Skip to content

Commit

Permalink
Replace validate_*_tables() with load_*_tables() parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesaoverton committed Nov 22, 2023
1 parent a47d8cc commit 4e5ff88
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,39 +91,22 @@ impl Valve {
self
}

/// Load all configured tables without validating, in dependency order.
/// Load all configured tables in dependency order.
/// If `validate` is false, just try to insert all rows.
/// Return an error on database problem,
/// including database conflicts that prevent rows being inserted.
pub fn load_all_tables(self) -> Result<Self, DatabaseError> {
pub fn load_all_tables(self, validate: bool) -> Result<Self, DatabaseError> {
self.create_all_tables();
self.truncate_all_tables();
todo!();
self
}

/// Given a vector of table names,
/// load those tables without validating, in the given order.
/// load those tables in the given order.
/// If `validate` is false, just try to insert all rows.
/// Return an error on invalid table name or database problem.
pub fn load_tables(self, tables: Vec<&str>) -> Result<Self, ConfigOrDatabaseError> {
self.create_all_tables();
self.truncate_tables(tables);
todo!();
self
}

/// Load and validate all configured tables in dependency order.
/// Return an error on database problem.
pub fn validate_all_tables(self) -> Result<Self, DatabaseError> {
self.create_all_tables();
self.truncate_all_tables();
todo!();
self
}

/// Given a vector of table names,
/// load and validate those tables in the given order.
/// Return an error on invalid table name or database problem.
pub fn validate_tables(self, tables: Vec<&str>) -> Result<Self, ConfigOrDatabaseError> {
pub fn load_tables(self, tables: Vec<&str>, validate: bool) -> Result<Self, ConfigOrDatabaseError> {
self.create_all_tables();
self.truncate_tables(tables);
todo!();
Expand Down

0 comments on commit 4e5ff88

Please sign in to comment.