pub struct NoteStore(/* private fields */);Implementations§
Source§impl NoteStore
impl NoteStore
Sourcepub fn upsert_file(&self, input: NoteFileInput) -> Result<WriteReceipt<Note>>
pub fn upsert_file(&self, input: NoteFileInput) -> Result<WriteReceipt<Note>>
读文件后同步一篇笔记:正文取文件原文,标题取文件名(去扩展名),路径即身份。 监听与对账在使用方;库只按给定路径处理这一个文件。
Sourcepub fn set_root(&self, namespace: &str, root: &str) -> Result<()>
pub fn set_root(&self, namespace: &str, root: &str) -> Result<()>
登记该知识领域的笔记根目录。登记之后写入的笔记路径必须是它的子路径: 库里存相对路径,相对路径按段拆出的标签挂到这篇的每一条切片上。
Sourcepub fn unset_root(&self, namespace: &str) -> Result<bool>
pub fn unset_root(&self, namespace: &str) -> Result<bool>
注销该领域的笔记根目录登记。只影响之后写入时的路径计算,已入库的笔记不动。 返回是否命中;没登记过的领域不报错。
pub fn get(&self, id: i64, filter: &ReadFilter) -> Result<Note>
Sourcepub fn get_many(
&self,
ids: &[i64],
filter: &ReadFilter,
) -> Result<BTreeMap<i64, Note>>
pub fn get_many( &self, ids: &[i64], filter: &ReadFilter, ) -> Result<BTreeMap<i64, Note>>
批量读取一批笔记,只返回满足 filter 的那些。
语义等同于对每个 id 依次调用 get,但把过滤压成一条 SQL、一次取回,
避免宿主逐条回库的往返开销。不满足过滤条件的 id 被静默跳过(不报错)。
pub fn list(&self, page: &PageRequest) -> Result<Page<Note>>
pub fn get_chunk(&self, id: i64, filter: &ReadFilter) -> Result<Chunk>
pub fn chunks(&self, note_id: i64, filter: &ReadFilter) -> Result<Vec<Chunk>>
pub fn delete(&self, id: i64, filter: &ReadFilter) -> Result<WriteReceipt<bool>>
Sourcepub fn delete_by_filter(
&self,
filter: &ReadFilter,
) -> Result<WriteReceipt<usize>>
pub fn delete_by_filter( &self, filter: &ReadFilter, ) -> Result<WriteReceipt<usize>>
删除过滤条件命中的全部笔记,返回删除条数。空命中返回 0。
每篇都连同它的切片一起删:chunks.note_id 是 RESTRICT 引用,先切片后笔记。
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for NoteStore
impl !UnwindSafe for NoteStore
impl Freeze for NoteStore
impl Send for NoteStore
impl Sync for NoteStore
impl Unpin for NoteStore
impl UnsafeUnpin for NoteStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more