Skip to content

Commit

Permalink
Remove Client::param
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Nov 19, 2024
1 parent aa627bf commit 38d3f63
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
10 changes: 1 addition & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#[macro_use]
extern crate static_assertions;

use self::{error::Result, http_client::HttpClient, sql::ser};
use ::serde::Serialize;
use self::{error::Result, http_client::HttpClient};
use std::{collections::HashMap, fmt::Display, sync::Arc};

pub use self::{compression::Compression, row::Row};
Expand Down Expand Up @@ -161,13 +160,6 @@ impl Client {
self
}

/// Specify server side parameter for all this client's queries.
pub fn param(self, name: &str, value: impl Serialize) -> Result<Self, String> {
let mut param = String::from("");
ser::write_param(&mut param, &value)?;
Ok(self.with_option(format!("param_{name}"), param))
}

/// Used to specify a header that will be passed to all queries.
///
/// # Example
Expand Down
5 changes: 2 additions & 3 deletions tests/it/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,11 @@ async fn fetch_one_and_optional() {

#[tokio::test]
async fn server_side_param() {
let client = prepare_database!()
.param("val1", 42)
.expect("failed to bind 42");
let client = prepare_database!();

let result = client
.query("SELECT plus({val1: Int32}, {val2: Int32}) AS result")
.param("val2", 42)
.param("val2", 144)
.fetch_one::<u64>()
.await
Expand Down

0 comments on commit 38d3f63

Please sign in to comment.