From 8ccb2e6c46a2b51349e5691f6bb877629f29ba8a Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Mon, 2 Jan 2023 17:24:49 -0800 Subject: [PATCH] missed a git add --- .../src/bin/web3_proxy_cli/count_users.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 web3_proxy/src/bin/web3_proxy_cli/count_users.rs diff --git a/web3_proxy/src/bin/web3_proxy_cli/count_users.rs b/web3_proxy/src/bin/web3_proxy_cli/count_users.rs new file mode 100644 index 00000000..ee309116 --- /dev/null +++ b/web3_proxy/src/bin/web3_proxy_cli/count_users.rs @@ -0,0 +1,19 @@ +use argh::FromArgs; +use entities::user; +use log::info; +use migration::sea_orm::{self, EntityTrait, PaginatorTrait}; + +#[derive(FromArgs, PartialEq, Debug, Eq)] +/// Create a new user and api key +#[argh(subcommand, name = "count_users")] +pub struct CountUsersSubCommand {} + +impl CountUsersSubCommand { + pub async fn main(self, db: &sea_orm::DatabaseConnection) -> anyhow::Result<()> { + let count = user::Entity::find().count(db).await?; + + info!("user count: {}", count); + + Ok(()) + } +}