rowdy-db 0.8.4

A fast, modern, and rowdy TUI database management tool written in Rust.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use async_trait::async_trait;
use crate::db::error::DbError;
use crate::db::types::{DbQueryResult, TableObject};

#[allow(dead_code)]
#[async_trait]
pub trait NoSqlClient: Send + Sync {
    async fn connect(&mut self, url: &str) -> Result<(), DbError>;
    async fn disconnect(&mut self) -> Result<(), DbError>;
    async fn list_collections(&self) -> Result<Vec<TableObject>, DbError>;
    async fn find(&self, collection: &str, filter: &str, limit: u64, offset: u64) -> Result<DbQueryResult, DbError>;
    async fn aggregate(&self, collection: &str, pipeline: &str) -> Result<DbQueryResult, DbError>;
    async fn count(&self, collection: &str, filter: &str) -> Result<u64, DbError>;
    // Write operations
    async fn insert_one(&self, collection: &str, doc_json: &str) -> Result<String, DbError>;
    async fn replace_one(&self, collection: &str, id: &str, doc_json: &str) -> Result<u64, DbError>;
    async fn delete_one(&self, collection: &str, id: &str) -> Result<u64, DbError>;
}