Add get count from query results object to TokensSchema
@@ -50,6 +50,13 @@ impl<'a> TokensSchema<'a> {
.collect())
}
+ /// Get count from query results object
+ pub fn get_count(&self) -> QueryResult<i64> {
+ let count: i64 = tokens::table.count().get_result(self.0.conn())?;
+
+ Ok(count)
+ }
+
/// Given the numeric token ID, symbol or address, returns token.
pub fn get_token(&self, token_like: TokenLike) -> QueryResult<Option<Token>> {
let db_token = match token_like {
