Rename Builder to Config
This commit is contained in:
@@ -6,7 +6,7 @@ use tokio_postgres::Error;
|
||||
use tokio_postgres::{MakeTlsMode, Socket, TlsMode};
|
||||
|
||||
#[cfg(feature = "runtime")]
|
||||
use crate::Builder;
|
||||
use crate::Config;
|
||||
use crate::{CopyOutReader, Query, Statement, ToStatement, Transaction};
|
||||
|
||||
pub struct Client(tokio_postgres::Client);
|
||||
@@ -21,12 +21,12 @@ impl Client {
|
||||
T::Future: Send,
|
||||
<T::TlsMode as TlsMode<Socket>>::Future: Send,
|
||||
{
|
||||
params.parse::<Builder>()?.connect(tls_mode)
|
||||
params.parse::<Config>()?.connect(tls_mode)
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime")]
|
||||
pub fn builder() -> Builder {
|
||||
Builder::new()
|
||||
pub fn builder() -> Config {
|
||||
Config::new()
|
||||
}
|
||||
|
||||
pub fn prepare(&mut self, query: &str) -> Result<Statement, Error> {
|
||||
|
||||
@@ -9,26 +9,26 @@ use tokio_postgres::{Error, MakeTlsMode, Socket, TlsMode};
|
||||
use crate::{Client, RUNTIME};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct Builder(tokio_postgres::Builder);
|
||||
pub struct Config(tokio_postgres::Config);
|
||||
|
||||
impl Default for Builder {
|
||||
fn default() -> Builder {
|
||||
Builder(tokio_postgres::Builder::default())
|
||||
impl Default for Config {
|
||||
fn default() -> Config {
|
||||
Config(tokio_postgres::Config::default())
|
||||
}
|
||||
}
|
||||
|
||||
impl Builder {
|
||||
pub fn new() -> Builder {
|
||||
Builder(tokio_postgres::Builder::new())
|
||||
impl Config {
|
||||
pub fn new() -> Config {
|
||||
Config(tokio_postgres::Config::new())
|
||||
}
|
||||
|
||||
pub fn host(&mut self, host: &str) -> &mut Builder {
|
||||
pub fn host(&mut self, host: &str) -> &mut Config {
|
||||
self.0.host(host);
|
||||
self
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
pub fn host_path<T>(&mut self, host: T) -> &mut Builder
|
||||
pub fn host_path<T>(&mut self, host: T) -> &mut Config
|
||||
where
|
||||
T: AsRef<Path>,
|
||||
{
|
||||
@@ -36,22 +36,22 @@ impl Builder {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn port(&mut self, port: u16) -> &mut Builder {
|
||||
pub fn port(&mut self, port: u16) -> &mut Config {
|
||||
self.0.port(port);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn param(&mut self, key: &str, value: &str) -> &mut Builder {
|
||||
pub fn param(&mut self, key: &str, value: &str) -> &mut Config {
|
||||
self.0.param(key, value);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn connect_timeout(&mut self, connect_timeout: Duration) -> &mut Builder {
|
||||
pub fn connect_timeout(&mut self, connect_timeout: Duration) -> &mut Config {
|
||||
self.0.connect_timeout(connect_timeout);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn password<T>(&mut self, password: T) -> &mut Builder
|
||||
pub fn password<T>(&mut self, password: T) -> &mut Config
|
||||
where
|
||||
T: AsRef<[u8]>,
|
||||
{
|
||||
@@ -76,10 +76,10 @@ impl Builder {
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for Builder {
|
||||
impl FromStr for Config {
|
||||
type Err = Error;
|
||||
|
||||
fn from_str(s: &str) -> Result<Builder, Error> {
|
||||
s.parse().map(Builder)
|
||||
fn from_str(s: &str) -> Result<Config, Error> {
|
||||
s.parse().map(Config)
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ use lazy_static::lazy_static;
|
||||
use tokio::runtime::{self, Runtime};
|
||||
|
||||
#[cfg(feature = "runtime")]
|
||||
mod builder;
|
||||
mod config;
|
||||
mod client;
|
||||
mod copy_out_reader;
|
||||
mod portal;
|
||||
@@ -19,7 +19,7 @@ mod transaction;
|
||||
mod test;
|
||||
|
||||
#[cfg(feature = "runtime")]
|
||||
pub use crate::builder::*;
|
||||
pub use crate::config::*;
|
||||
pub use crate::client::*;
|
||||
pub use crate::copy_out_reader::*;
|
||||
pub use crate::portal::*;
|
||||
|
||||
Reference in New Issue
Block a user