File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
sqlx-postgres/src/options Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 11use std:: borrow:: Cow ;
22use std:: env:: var;
3+ use std:: ffi:: OsStr ;
34use std:: fmt:: { self , Display , Write } ;
45use std:: path:: { Path , PathBuf } ;
56
@@ -187,6 +188,23 @@ impl PgConnectOptions {
187188 self
188189 }
189190
191+ /// Sets the paths to try when looking for the pgpass file.
192+ ///
193+ /// # Example
194+ ///
195+ /// ```rust
196+ /// # use sqlx_postgres::PgConnectOptions;
197+ /// let options = PgConnectOptions::new()
198+ /// .passfile_paths(&["/non/default/pgpass"]);
199+ /// ```
200+ pub fn passfile_paths < P > ( mut self , paths : impl IntoIterator < Item = P > ) -> Self
201+ where
202+ P : Into < PathBuf > + AsRef < OsStr > ,
203+ {
204+ self . passfile_paths = paths. into_iter ( ) . map ( Into :: into) . collect ( ) ;
205+ self
206+ }
207+
190208 /// Sets the database name. Defaults to be the same as the user name.
191209 ///
192210 /// # Example
You can’t perform that action at this time.
0 commit comments