Delete a function by tenant_id + name. Returns `true` if the function existed and was removed.
(&self, tenant_id: u64, name: &str)
| 58 | /// |
| 59 | /// Returns `true` if the function existed and was removed. |
| 60 | pub fn delete_function(&self, tenant_id: u64, name: &str) -> crate::Result<bool> { |
| 61 | let key = function_key(tenant_id, name); |
| 62 | let write_txn = self |
| 63 | .db |
| 64 | .begin_write() |
| 65 | .map_err(|e| catalog_err("write txn", e))?; |
| 66 | let existed; |
| 67 | { |
| 68 | let mut table = write_txn |
| 69 | .open_table(FUNCTIONS) |
| 70 | .map_err(|e| catalog_err("open functions", e))?; |
| 71 | existed = table |
| 72 | .remove(key.as_str()) |
| 73 | .map_err(|e| catalog_err("remove function", e))? |
| 74 | .is_some(); |
| 75 | } |
| 76 | write_txn.commit().map_err(|e| catalog_err("commit", e))?; |
| 77 | Ok(existed) |
| 78 | } |
| 79 | |
| 80 | /// Load every user-defined function across all tenants. Used |
| 81 | /// by the startup integrity check and any cross-tenant audit. |
no test coverage detected