app

Local-first trade for farms and co-ops
git clone https://radroots.dev/git/app.git
Log | Files | Refs | README | LICENSE

commit e656e379939de6b8babfefefb59190358ee9f639
parent d76d6f3bfc6c02b7cdd693b5ae21f6ba2bfb96e3
Author: triesap <triesap@radroots.dev>
Date:   Mon, 19 Jan 2026 07:13:23 +0000

app-utils: add idb config types

- add idb client config struct
- add optional string alias type
- export idb config types from utils
- add unit tests for idb types

Diffstat:
Mcrates/utils/src/lib.rs | 6+++---
Mcrates/utils/src/types.rs | 25+++++++++++++++++++++++--
2 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/crates/utils/src/lib.rs b/crates/utils/src/lib.rs @@ -27,7 +27,7 @@ pub use path::{ pub use text::{str_cap, str_cap_words, text_dec, text_enc, ROOT_SYMBOL}; pub use time::{time_now_ms, time_now_s}; pub use types::{ - resolve_err, resolve_ok, FileBytesFormat, FilePath, FilePathBlob, FileMimeType, ResolveError, - ResultBool, ResultId, ResultObj, ResultPass, ResultPublicKey, ResultSecretKey, ResultsList, - WebFilePath, + resolve_err, resolve_ok, FileBytesFormat, FilePath, FilePathBlob, FileMimeType, IdbClientConfig, + ResolveError, ResultBool, ResultId, ResultObj, ResultPass, ResultPublicKey, ResultSecretKey, + ResultsList, ValStr, WebFilePath, }; diff --git a/crates/utils/src/types.rs b/crates/utils/src/types.rs @@ -33,6 +33,14 @@ pub enum WebFilePath { Blob(FilePathBlob), } +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct IdbClientConfig { + pub database: String, + pub store: String, +} + +pub type ValStr = Option<String>; + #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct ResultPass { pub pass: bool, @@ -82,8 +90,9 @@ pub fn resolve_err<T>(err: RadrootsAppUtilsError) -> ResolveError<T> { #[cfg(test)] mod tests { use super::{ - resolve_err, resolve_ok, FileBytesFormat, FilePath, FilePathBlob, ResultBool, ResultId, - ResultObj, ResultPass, ResultPublicKey, ResultSecretKey, ResultsList, WebFilePath, + resolve_err, resolve_ok, FileBytesFormat, FilePath, FilePathBlob, IdbClientConfig, + ResultBool, ResultId, ResultObj, ResultPass, ResultPublicKey, ResultSecretKey, ResultsList, + ValStr, WebFilePath, }; use crate::error::RadrootsAppUtilsError; @@ -148,4 +157,16 @@ mod tests { assert_eq!(blob_path, WebFilePath::Blob(blob)); assert_eq!(FileBytesFormat::Kb, FileBytesFormat::Kb); } + + #[test] + fn idb_config_stores_values() { + let config = IdbClientConfig { + database: "db".to_string(), + store: "store".to_string(), + }; + assert_eq!(config.database, "db"); + assert_eq!(config.store, "store"); + let value: ValStr = None; + assert!(value.is_none()); + } }