pub struct Config { /* private fields */ }Expand description
How to reach a SQL Server instance.
Build it fluently:
use tdsql::Config;
let config = Config::new()
.host("localhost")
.port(1433)
.database("master")
.auth("sa", "YourStrong!Passw0rd")
.trust_cert();or parse a connection string:
use tdsql::Config;
let config = Config::from_ado_string(
"Server=tcp:localhost,1433;Database=master;User Id=sa;Password=pw;TrustServerCertificate=true",
);Implementations§
Source§impl Config
impl Config
Sourcepub fn from_ado_string(s: impl Into<String>) -> Self
pub fn from_ado_string(s: impl Into<String>) -> Self
Configure from an ADO.NET-style connection string.
The string is parsed by the driver when connecting, so errors surface
from Client::connect.
Sourcepub fn from_jdbc_string(s: impl Into<String>) -> Self
pub fn from_jdbc_string(s: impl Into<String>) -> Self
Configure from a JDBC-style connection string.
Sourcepub fn auth(
self,
username: impl Into<String>,
password: impl Into<String>,
) -> Self
pub fn auth( self, username: impl Into<String>, password: impl Into<String>, ) -> Self
Use SQL Server authentication with these credentials.
Sourcepub fn trust_cert(self) -> Self
pub fn trust_cert(self) -> Self
Accept the server’s TLS certificate without validating it.
Convenient against a local container; do not use in production.
Sourcepub fn connect_timeout(self, timeout: Option<Duration>) -> Self
pub fn connect_timeout(self, timeout: Option<Duration>) -> Self
How long Client::connect may take, from
the TCP connect through the login: 15 seconds unless set, None for
no limit. A connection string sets it with Connect Timeout.
Sourcepub fn application_name(self, name: impl Into<String>) -> Self
pub fn application_name(self, name: impl Into<String>) -> Self
Set the application name reported to the server.
Trait Implementations§
impl Eq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more