diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-11 14:20:49 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-11 14:20:49 +0200 |
| commit | 199563550dd41c3dfb703bd3747604a8a03cdbc5 (patch) | |
| tree | 30cfa3e5539f782b7571091c742ee1c219e138fb /crates/turtle/src/atuin_client/database.rs | |
| parent | chore: Restore db migrations (diff) | |
| download | atuin-199563550dd41c3dfb703bd3747604a8a03cdbc5.zip | |
chore: Remove all `pub`s
They will not be marked by rustc/cargo as unused, and as atuin doesn't
expose an API all of them _should_ be `pub(crate)`
Diffstat (limited to 'crates/turtle/src/atuin_client/database.rs')
| -rw-r--r-- | crates/turtle/src/atuin_client/database.rs | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/crates/turtle/src/atuin_client/database.rs b/crates/turtle/src/atuin_client/database.rs index 27f46da5..1bfe93a7 100644 --- a/crates/turtle/src/atuin_client/database.rs +++ b/crates/turtle/src/atuin_client/database.rs @@ -35,31 +35,31 @@ use super::{ }; #[derive(Clone)] -pub struct Context { - pub session: String, - pub cwd: String, - pub hostname: String, - pub host_id: String, - pub git_root: Option<PathBuf>, +pub(crate) struct Context { + pub(crate) session: String, + pub(crate) cwd: String, + pub(crate) hostname: String, + pub(crate) host_id: String, + pub(crate) git_root: Option<PathBuf>, } #[derive(Default, Clone)] -pub struct OptFilters { - pub exit: Option<i64>, - pub exclude_exit: Option<i64>, - pub cwd: Option<String>, - pub exclude_cwd: Option<String>, - pub before: Option<String>, - pub after: Option<String>, - pub limit: Option<i64>, - pub offset: Option<i64>, - pub reverse: bool, - pub include_duplicates: bool, +pub(crate) struct OptFilters { + pub(crate) exit: Option<i64>, + pub(crate) exclude_exit: Option<i64>, + pub(crate) cwd: Option<String>, + pub(crate) exclude_cwd: Option<String>, + pub(crate) before: Option<String>, + pub(crate) after: Option<String>, + pub(crate) limit: Option<i64>, + pub(crate) offset: Option<i64>, + pub(crate) reverse: bool, + pub(crate) include_duplicates: bool, /// Author filter. Supports special values `$all-user` and `$all-agent`. - pub authors: Vec<String>, + pub(crate) authors: Vec<String>, } -pub async fn current_context() -> eyre::Result<Context> { +pub(crate) async fn current_context() -> eyre::Result<Context> { let session = env::var("ATUIN_SESSION").map_err(|_| { eyre::eyre!("Failed to find $ATUIN_SESSION in the environment. Check that you have correctly set up your shell.") })?; @@ -78,7 +78,7 @@ pub async fn current_context() -> eyre::Result<Context> { } impl Context { - pub fn from_history(entry: &History) -> Self { + pub(crate) fn from_history(entry: &History) -> Self { Context { session: entry.session.to_string(), cwd: entry.cwd.to_string(), @@ -132,7 +132,7 @@ fn get_session_start_time(session_id: &str) -> Option<i64> { } #[async_trait] -pub trait Database: Send + Sync + 'static { +pub(crate) trait Database: Send + Sync + 'static { async fn save(&self, h: &History) -> Result<()>; async fn save_bulk(&self, h: &[History]) -> Result<()>; @@ -186,12 +186,12 @@ pub trait Database: Send + Sync + 'static { // Intended for use on a developer machine and not a sync server. // TODO: implement IntoIterator #[derive(Debug, Clone)] -pub struct Sqlite { - pub pool: SqlitePool, +pub(crate) struct Sqlite { + pub(crate) pool: SqlitePool, } impl Sqlite { - pub async fn new(path: impl AsRef<Path>, timeout: f64) -> Result<Self> { + pub(crate) async fn new(path: impl AsRef<Path>, timeout: f64) -> Result<Self> { let path = path.as_ref(); debug!("opening sqlite database at {path:?}"); @@ -224,7 +224,7 @@ impl Sqlite { Ok(Self { pool }) } - pub async fn sqlite_version(&self) -> Result<String> { + pub(crate) async fn sqlite_version(&self) -> Result<String> { sqlx::query_scalar("SELECT sqlite_version()") .fetch_one(&self.pool) .await @@ -868,7 +868,7 @@ impl Database for Sqlite { } } -pub struct Paged { +pub(crate) struct Paged { database: Box<dyn Database + 'static>, page_size: usize, last_id: Option<String>, @@ -877,7 +877,7 @@ pub struct Paged { } impl Paged { - pub fn new( + pub(crate) fn new( database: Box<dyn Database + 'static>, page_size: usize, include_deleted: bool, @@ -892,7 +892,7 @@ impl Paged { } } - pub async fn next(&mut self) -> Result<Option<Vec<History>>> { + pub(crate) async fn next(&mut self) -> Result<Option<Vec<History>>> { let mut query = SqlBuilder::select_from(SqlName::new("history").alias("h").baquoted()); query.field("*").order_desc("id"); @@ -1434,12 +1434,12 @@ mod test { } } -pub struct QueryTokenizer<'a> { +pub(crate) struct QueryTokenizer<'a> { query: &'a str, last_pos: usize, } -pub enum QueryToken<'a> { +pub(crate) enum QueryToken<'a> { Match(&'a str, bool), MatchStart(&'a str, bool), MatchEnd(&'a str, bool), @@ -1449,7 +1449,7 @@ pub enum QueryToken<'a> { } impl<'a> QueryToken<'a> { - pub fn has_uppercase(&self) -> bool { + pub(crate) fn has_uppercase(&self) -> bool { match self { Self::Match(term, _) | Self::MatchStart(term, _) @@ -1459,7 +1459,7 @@ impl<'a> QueryToken<'a> { } } - pub fn is_inverse(&self) -> bool { + pub(crate) fn is_inverse(&self) -> bool { match self { Self::Match(_, inv) | Self::MatchStart(_, inv) @@ -1471,7 +1471,7 @@ impl<'a> QueryToken<'a> { } impl<'a> QueryTokenizer<'a> { - pub fn new(query: &'a str) -> Self { + pub(crate) fn new(query: &'a str) -> Self { Self { query, last_pos: 0 } } } |
