pub fn add_annotation(
        &self,
        annotation: &Annotation,
        annotation_batch: &mut sled::Batch,
    ) -> color_eyre::Result<()> {
        let annotation_key = annotation.id.as_bytes();
        annotation_batch.insert(annotation_key, utils::join_ids(&annotation.tags)?);
        if annotation.tags.is_empty() || !annotation.tags.iter().any(|t| !t.trim().is_empty()) {
            self.add_to_tag(EMPTY_TAG.as_bytes(), annotation_key)?;
        } else {
            for tag in &annotation.tags {
                if tag.is_empty() {
                    continue;
                }
                let tag_key = tag.as_bytes();
                self.add_to_tag(tag_key, annotation_key)?;
            }
        }
        Ok(())
    }
/// Add an annotation to both trees
Add an annotation to both trees
Add an annotation to both trees
pub fn add_annotation(
        &self,
        annotation: &Annotation,
        annotation_batch: &mut sled::Batch,
    ) -> color_eyre::Result<()> {
        let annotation_key = annotation.id.as_bytes();
        annotation_batch.insert(annotation_key, utils::join_ids(&annotation.tags)?);
        if annotation.tags.is_empty() || !annotation.tags.iter().any(|t| !t.trim().is_empty()) {
            self.add_to_tag(EMPTY_TAG.as_bytes(), annotation_key)?;
        } else {
            for tag in &annotation.tags {
                if tag.is_empty() {
                    continue;
                }
                let tag_key = tag.as_bytes();
                self.add_to_tag(tag_key, annotation_key)?;
            }
        }
        Ok(())
    }
pub fn add_annotation ( & self , annotation : & Annotation , annotation_batch : & mut sled :: Batch , ) -> color_eyre :: Result < ( ) > { let annotation_key = annotation . id . as_bytes ( ) ; annotation_batch . insert ( annotation_key , utils :: join_ids ( & annotation . tags ) ? ) ; if annotation . tags . is_empty ( ) || ! annotation . tags . iter ( ) . any ( | t | ! t . trim ( ) . is_empty ( ) ) { self . add_to_tag ( EMPTY_TAG . as_bytes ( ) , annotation_key ) ? ; } else { for tag in & annotation . tags { if tag . is_empty ( ) { continue ; } let tag_key = tag . as_bytes ( ) ; self . add_to_tag ( tag_key , annotation_key ) ? ; } } Ok ( ( ) ) }
Add an annotation to both trees
Add an annotation to both trees
&self
annotation
&Annotation
annotation_batch
&mut sled::Batch
&self
annotation
&Annotation
annotation_batch
&mut sled::Batch