Add a table to the server state.
(&self, database: &str, table: &str)
| 541 | |
| 542 | /// Add a table to the server state. |
| 543 | pub fn add_table(&self, database: &str, table: &str) { |
| 544 | let mut s = self.inner.lock().unwrap(); |
| 545 | s.databases.entry(database.to_string()).or_insert_with(|| { |
| 546 | // Auto-create database if not exists |
| 547 | GetDatabaseResponse::new( |
| 548 | Some(database.to_string()), |
| 549 | Some(database.to_string()), |
| 550 | None, |
| 551 | HashMap::new(), |
| 552 | AuditRESTResponse::new(None, None, None, None, None), |
| 553 | ) |
| 554 | }); |
| 555 | |
| 556 | let key = format!("{database}.{table}"); |
| 557 | s.tables.entry(key).or_insert_with(|| { |
| 558 | GetTableResponse::new( |
| 559 | Some(table.to_string()), |
| 560 | Some(table.to_string()), |
| 561 | None, |
| 562 | Some(true), |
| 563 | None, |
| 564 | None, |
| 565 | AuditRESTResponse::new(None, None, None, None, None), |
| 566 | ) |
| 567 | }); |
| 568 | } |
| 569 | |
| 570 | /// Add a table with schema and path to the server state. |
| 571 | /// |
no test coverage detected