You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sql/core/database_strategy_mysql/src/lib.rs
+10Lines changed: 10 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -190,6 +190,16 @@ impl DatabaseStrategy for MysqlDatabaseStrategy {
190
190
}
191
191
}
192
192
193
+
fnnum_idle(&self) -> Result<usize,Error>{
194
+
let pool = self.pool.as_ref().ok_or(Error::PoolClosed)?;
195
+
Ok(pool.num_idle())
196
+
}
197
+
198
+
fnsize(&self) -> Result<u32,Error>{
199
+
let pool = self.pool.as_ref().ok_or(Error::PoolClosed)?;
200
+
Ok(pool.size())
201
+
}
202
+
193
203
/// check to exists devup_revisions table
194
204
asyncfnhas_revision(&self) -> Result<bool,Error>{
195
205
Ok(self.fetch_one("SELECT COUNT(*) as count FROM information_schema.tables WHERE table_name = 'devup_revision'",&[],None).await?.as_u64().unwrap_or(0) > 0)
Copy file name to clipboardExpand all lines: sql/core/database_strategy_postgres/src/lib.rs
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -189,6 +189,17 @@ impl DatabaseStrategy for PostgresDatabaseStrategy {
189
189
_ => Err(Error::BeginFailed),
190
190
}
191
191
}
192
+
193
+
fnnum_idle(&self) -> Result<usize,Error>{
194
+
let pool = self.pool.as_ref().ok_or(Error::PoolClosed)?;
195
+
Ok(pool.num_idle())
196
+
}
197
+
198
+
fnsize(&self) -> Result<u32,Error>{
199
+
let pool = self.pool.as_ref().ok_or(Error::PoolClosed)?;
200
+
Ok(pool.size())
201
+
}
202
+
192
203
/// check to exists devup_revisions table
193
204
asyncfnhas_revision(&self) -> Result<bool,Error>{
194
205
Ok(self.fetch_one("SELECT COUNT(*) as count FROM information_schema.tables WHERE table_name = 'devup_revision'",&[],None).await?.as_u64().unwrap_or(0) > 0)
Copy file name to clipboardExpand all lines: sql/core/database_strategy_sqlite/src/lib.rs
+11-1Lines changed: 11 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -205,8 +205,18 @@ impl DatabaseStrategy for SqliteDatabaseStrategy {
205
205
_ => Err(Error::BeginFailed),
206
206
}
207
207
}
208
+
209
+
fnnum_idle(&self) -> Result<usize,Error>{
210
+
let pool = self.pool.as_ref().ok_or(Error::PoolClosed)?;
211
+
Ok(pool.num_idle())
212
+
}
213
+
214
+
fnsize(&self) -> Result<u32,Error>{
215
+
let pool = self.pool.as_ref().ok_or(Error::PoolClosed)?;
216
+
Ok(pool.size())
217
+
}
218
+
208
219
/// check to exists devup_revisions table
209
-
///
210
220
asyncfnhas_revision(&self) -> Result<bool,Error>{
211
221
Ok(self.fetch_one("SELECT COUNT(*) as count FROM sqlite_master WHERE type = 'table' AND name = 'devup_revision'",&[],None).await?.as_u64().unwrap_or(0) > 0)
0 commit comments