MCPcopy Create free account
hub / github.com/Botloader/botloader / count

Method count

components/stores/src/bucketstore.rs:257–276  ·  view source on GitHub ↗
(
        &self,
        guild_id: Id<GuildMarker>,
        plugin_id: Option<u64>,
        bucket: String,
        key_pattern: String,
    )

Source from the content-addressed store, hash-verified

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!(

Callers 15

testJsonFunction · 0.80
assertCountFunction · 0.80
assertCountFunction · 0.80
add_plugin_imageFunction · 0.80
check_plugin_nameFunction · 0.80
check_script_nameFunction · 0.80
check_name_fieldFunction · 0.80
check_description_fieldFunction · 0.80
validateMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected