chore: replace dotenv with dotenvy (#2003)

* chore: replace `dotenv` with `dotenvy`

The former appears to be unmaintained and the latter is a drop-in replacement.

* chore: fix all warnings
This commit is contained in:
Austin Bonander
2022-07-28 14:33:44 -07:00
committed by GitHub
parent 05d64fb722
commit a2eceec33b
32 changed files with 70 additions and 62 deletions

View File

@@ -16,6 +16,7 @@ pub(crate) struct ColumnData {
// The user type ID of the data type of the column. Depending on the TDS version that is used,
// valid values are 0x0000 or 0x00000000, with the exceptions of data type
// TIMESTAMP (0x0050 or 0x00000050) and alias types (greater than 0x00FF or 0x000000FF).
#[allow(dead_code)]
pub(crate) user_type: u32,
pub(crate) flags: Flags,

View File

@@ -9,6 +9,7 @@ pub(crate) struct Done {
// The token of the current SQL statement. The token value is provided and controlled by the
// application layer, which utilizes TDS. The TDS layer does not evaluate the value.
#[allow(dead_code)]
cursor_command: u16,
// The count of rows that were affected by the SQL statement. The value of DoneRowCount is

View File

@@ -4,6 +4,7 @@ use crate::error::Error;
#[derive(Debug)]
pub(crate) struct Order {
#[allow(dead_code)]
columns: Bytes,
}

View File

@@ -4,6 +4,7 @@ use crate::error::Error;
#[derive(Debug)]
pub(crate) struct ReturnStatus {
#[allow(dead_code)]
value: i32,
}

View File

@@ -27,8 +27,7 @@ impl MigrateDatabase for Sqlite {
}
// Opening a connection to sqlite creates the database
let _ = SqliteConnectOptions::from_str(url)?
.create_if_missing(true)
let _ = opts
.connect()
.await?
// Ensure WAL mode tempfiles are cleaned up

View File

@@ -154,7 +154,7 @@ impl SqliteConnectOptions {
///
/// SQLx chooses to enable this by default so that foreign keys function as expected,
/// compared to other database flavors.
pub fn foreign_keys(mut self, on: bool) -> Self {
pub fn foreign_keys(self, on: bool) -> Self {
self.pragma("foreign_keys", if on { "ON" } else { "OFF" })
}
@@ -187,14 +187,14 @@ impl SqliteConnectOptions {
///
/// For consistency, any commands in `sqlx-cli` which create a SQLite database will create it
/// in WAL mode.
pub fn journal_mode(mut self, mode: SqliteJournalMode) -> Self {
pub fn journal_mode(self, mode: SqliteJournalMode) -> Self {
self.pragma("journal_mode", mode.as_str())
}
/// Sets the [locking mode](https://www.sqlite.org/pragma.html#pragma_locking_mode) for the database connection.
///
/// The default locking mode is NORMAL.
pub fn locking_mode(mut self, mode: SqliteLockingMode) -> Self {
pub fn locking_mode(self, mode: SqliteLockingMode) -> Self {
self.pragma("locking_mode", mode.as_str())
}
@@ -238,7 +238,7 @@ impl SqliteConnectOptions {
///
/// The default synchronous settings is FULL. However, if durability is not a concern,
/// then NORMAL is normally all one needs in WAL mode.
pub fn synchronous(mut self, synchronous: SqliteSynchronous) -> Self {
pub fn synchronous(self, synchronous: SqliteSynchronous) -> Self {
self.pragma("synchronous", synchronous.as_str())
}
@@ -248,7 +248,7 @@ impl SqliteConnectOptions {
///
/// For existing databases, a change to this value does not take effect unless a
/// [`VACUUM` command](https://www.sqlite.org/lang_vacuum.html) is executed.
pub fn auto_vacuum(mut self, auto_vacuum: SqliteAutoVacuum) -> Self {
pub fn auto_vacuum(self, auto_vacuum: SqliteAutoVacuum) -> Self {
self.pragma("auto_vacuum", auto_vacuum.as_str())
}
@@ -259,7 +259,7 @@ impl SqliteConnectOptions {
/// For existing databases, a change to this value does not take effect unless a
/// [`VACUUM` command](https://www.sqlite.org/lang_vacuum.html) is executed.
/// However, it cannot be changed in WAL mode.
pub fn page_size(mut self, page_size: u32) -> Self {
pub fn page_size(self, page_size: u32) -> Self {
self.pragma("page_size", page_size.to_string())
}