1
0
mirror of https://github.com/bitwarden/server synced 2026-02-13 23:13:22 +00:00

Clean up unused methods

This commit is contained in:
Matt Gibson
2025-10-28 17:12:36 -07:00
parent 15ab667072
commit 532b44030b
3 changed files with 0 additions and 88 deletions

View File

@@ -71,14 +71,6 @@ impl SqlParams {
.collect()
}
pub fn keys_except_columns(&self, excludes: Vec<&str>) -> Vec<String> {
self.params
.iter()
.filter(|p| !excludes.contains(&p.column.as_str()))
.map(|p| p.key.clone())
.collect()
}
pub fn key_for(&self, column: &str) -> Option<String> {
self.params
.iter()
@@ -93,28 +85,6 @@ impl SqlParams {
.collect()
}
pub fn columns_except(&self, excludes: Vec<&str>) -> Vec<String> {
self.params
.iter()
.filter(|p| !excludes.contains(&p.column.as_str()))
.map(|p| p.column())
.collect()
}
pub fn columns_prefix_with(&self, prefix: &str) -> Vec<String> {
self.params
.iter()
.map(|p| format!("{}{}", prefix, p.column()))
.collect()
}
pub fn set_columns_equal(&self, assign_prefix: &str, source_prefix: &str) -> Vec<String> {
self.params
.iter()
.map(|p| format!("{}{} = {}{}", assign_prefix, p.column(), source_prefix, p.column()))
.collect()
}
pub fn set_columns_equal_except(
&self,
assign_prefix: &str,
@@ -135,58 +105,3 @@ impl SqlParams {
.collect()
}
}
pub struct VecStringBuilder<'a> {
strings: Vec<String>,
ops: Vec<StringBuilderOperation<'a>>,
}
enum StringBuilderOperation<'a> {
StringOperation(Box<dyn Fn(String) -> String + 'a>),
VectorOperation(Box<dyn Fn(Vec<String>) -> Vec<String> + 'a>),
}
impl<'a> VecStringBuilder<'a> {
pub fn new(strings: Vec<String>) -> Self {
Self {
strings,
ops: Vec::new(),
}
}
pub fn map<F>(&mut self, op: F)
where
F: Fn(String) -> String + 'static,
{
self.ops.push(StringBuilderOperation::StringOperation(Box::new(op)));
}
pub fn build(self) -> Vec<String> {
let mut result = self.strings;
for op in self.ops {
match op {
StringBuilderOperation::StringOperation(f) => {
result = result.into_iter().map(f.as_ref()).collect();
}
StringBuilderOperation::VectorOperation(f) => {
result = f(result);
}
}
}
result
}
pub fn join(self, sep: &str) -> String {
self.build().join(sep)
}
pub fn except(&mut self, excludes: Vec<&'a str>) {
self.ops.push(StringBuilderOperation::VectorOperation(Box::new(
move |vec: Vec<String>| {
vec.into_iter()
.filter(|s| !excludes.contains(&s.as_str()))
.collect()
},
)));
}
}

View File

@@ -21,6 +21,5 @@ tiberius = { version = "0.12.3", default-features = false, features = ["chrono",
[target.'cfg(not(target_os = "macos"))'.workspace.dependencies]
tiberius = { version = "0.12.3", features = ["chrono", "tokio"] }
[lints]
workspace = true

View File

@@ -1,5 +1,3 @@
use tracing::{info, trace};
#[tokio::main]
async fn main() {
tracing_subscriber::fmt()