(
&self,
guild_id: Id<GuildMarker>,
plugin_id: Option<u64>,
bucket: String,
key_pattern: String,
)
| 255 | } |
| 256 | |
| 257 | pub async fn count( |
| 258 | &self, |
| 259 | guild_id: Id<GuildMarker>, |
| 260 | plugin_id: Option<u64>, |
| 261 | bucket: String, |
| 262 | key_pattern: String, |
| 263 | ) -> StoreResult<u64> { |
| 264 | let res = sqlx::query!( |
| 265 | "SELECT count(*) FROM bucket_store WHERE guild_id = $1 AND plugin_id = $2 AND bucket \ |
| 266 | = $3 AND key ILIKE $4 AND (expires_at IS NULL OR expires_at > now());", |
| 267 | guild_id.get() as i64, |
| 268 | plugin_id.unwrap_or(0) as i64, |
| 269 | bucket, |
| 270 | key_pattern, |
| 271 | ) |
| 272 | .fetch_one(&self.pool) |
| 273 | .await?; |
| 274 | |
| 275 | Ok(res.count.unwrap_or_default() as u64) |
| 276 | } |
| 277 | |
| 278 | pub async fn guild_storage_usage_bytes(&self, guild_id: Id<GuildMarker>) -> StoreResult<u64> { |
| 279 | let res = sqlx::query!( |
no outgoing calls
no test coverage detected