- Notifications
You must be signed in to change notification settings - Fork514
Improve the documentation of tokio-postgres connect#1099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -180,12 +180,32 @@ mod transaction_builder; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
pub mod types; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// A convenience function which parses a connection string and connects to the database. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// This method returns the client which will allow you to interact with the database and a connection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// object which is the one that performs the communication with the dabase. **It's important to use the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// connection object as shown in the below example, if it is ignored then the client object will not work | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// and when a .wait is called it will await forever.** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines +184 to +187 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I've cleaned it up a bit. Suggested change
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// See the documentation for [`Config`] for details on the connection string format. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// Requires the `runtime` Cargo feature (enabled by default). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// [`Config`]: config/struct.Config.html | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines 192 to 193 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This should go below the examples section. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// # Examples | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// ``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// // Connect to the database. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// let (client, connection) = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// tokio_postgres::connect("host=localhost user=postgres", NoTls).await?; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// // The connection object performs the actual communication with the database, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// // so spawn it off to run on its own. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// tokio::spawn(async move { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// if let Err(e) = connection.await { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// eprintln!("connection error: {}", e); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// // Use the client | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
/// ``` | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines +195 to +208 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#[cfg(feature = "runtime")] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
pub async fn connect<T>( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
config: &str, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||