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 1
1
use std:: borrow:: Cow ;
2
2
use std:: env:: var;
3
+ use std:: ffi:: OsStr ;
3
4
use std:: fmt:: { self , Display , Write } ;
4
5
use std:: path:: { Path , PathBuf } ;
5
6
@@ -187,6 +188,23 @@ impl PgConnectOptions {
187
188
self
188
189
}
189
190
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
+
190
208
/// Sets the database name. Defaults to be the same as the user name.
191
209
///
192
210
/// # Example
You can’t perform that action at this time.
0 commit comments