[][src]Struct gooseberry::gooseberry::Gooseberry

pub struct Gooseberry { /* fields omitted */ }

Gooseberry database, API client, and configuration

Implementations

impl Gooseberry[src]

Database

sled database related functions to create, manipulate, and retrieve information in the annotation ID: (tags IDs) tree and the tag ID: (annotation IDs) tree. Also stores and updates the time of the last sync.

pub fn get_db(db_dir: &Path) -> Result<Db>[src]

Gets the sled database with all gooseberry info. Makes a new one the first time round

pub fn set_merge(&self) -> Result<()>[src]

Merge function for appending items to an existing key, uses semicolons

pub fn reset_sync_time(&self) -> Result<()>[src]

(re)sets time of last sync to way in the past

pub fn set_sync_time(&self, datetime: &str) -> Result<()>[src]

Update last sync time after sync

pub fn get_sync_time(&self) -> Result<String>[src]

Get time of last sync

pub fn annotation_to_tags(&self) -> Result<Tree>[src]

Tree storing annotation id: (tags ...) Referred to as the annotation tree

pub fn tag_to_annotations(&self) -> Result<Tree>[src]

Tree storing tag: ( annotation IDs ...) Referred to as the tags tree

pub fn add_to_tag(&self, tag_key: &[u8], annotation_key: &[u8]) -> Result<()>[src]

pub fn add_annotation(
    &self,
    annotation: &Annotation,
    annotation_batch: &mut Batch
) -> Result<()>
[src]

Add an annotation to both trees

pub fn sync_annotations(
    &self,
    annotations: &[Annotation]
) -> Result<(usize, usize, usize)>
[src]

add or update annotations from the Hypothesis API

pub fn delete_from_tag(&self, tag_key: &[u8], annotation_id: &str) -> Result<()>[src]

Delete an annotation index from the tag tree

pub fn delete_from_annotations(&self, id: &str) -> Result<Vec<String>>[src]

Delete an annotation ID from the annotation tree

pub fn delete_annotation(&self, id: &str) -> Result<Vec<String>>[src]

Delete annotation from database

pub fn delete_annotations(&self, ids: &[String]) -> Result<Vec<Vec<String>>>[src]

Delete multiple annotations

pub fn get_tagged_annotations(&self, tag: &str) -> Result<Vec<String>>[src]

Retrieve annotations tagged with a given tag

pub fn get_annotation_tags(&self, id: &str) -> Result<Vec<String>>[src]

Retrieve tags associated with an annotation

impl Gooseberry[src]

Markdown generation

functions related to generating the mdBook wiki

pub async fn make(&mut self) -> Result<()>[src]

Make mdBook wiki

impl Gooseberry[src]

Search

skim search window functions

pub async fn search(
    &self,
    annotations: Vec<Annotation>,
    hbs: &Handlebars<'_>,
    fuzzy: bool
) -> Result<()>
[src]

Makes a skim search window for given annotations

pub fn search_group(
    annotations: &[Annotation],
    hbs: &Handlebars<'_>,
    fuzzy: bool
) -> Result<HashSet<String>>
[src]

Makes a skim search window for given annotations from an external group

impl Gooseberry[src]

CLI

Functions related to handling CLI commands

pub async fn start(cli: GooseberryCLI) -> Result<()>[src]

Initialize program with command line input. Reads sled trees and metadata file from the locations specified in config. (makes new ones the first time).

pub async fn run(&mut self, cli: GooseberryCLI) -> Result<()>[src]

Run knowledge-base related functions

pub async fn sync(&self) -> Result<()>[src]

Sync newly added / updated annotations

pub async fn sync_group(
    &self,
    group_id: String,
    filters: Filters,
    search: bool,
    fuzzy: bool
) -> Result<()>
[src]

Move (optionally filtered) annotations from a different group to the group gooseberry looks at (set in config)

pub async fn filter_annotations(
    &self,
    filters: Filters,
    group: Option<String>
) -> Result<Vec<Annotation>>
[src]

Filter annotations based on command-line flags

pub async fn tag(
    &self,
    annotations: Vec<Annotation>,
    delete: bool,
    tag: Option<String>
) -> Result<()>
[src]

Tag a filtered set of annotations with a given tag

pub async fn delete(
    &self,
    annotations: Vec<Annotation>,
    hypothesis: bool,
    force: bool
) -> Result<()>
[src]

Delete filtered annotations from gooseberry (by adding an ignore tag) or also from Hypothesis

pub async fn view(&self, filters: Filters, id: Option<String>) -> Result<()>[src]

View optionally filtered annotations in the terminal

pub fn clear(&self, force: bool) -> Result<()>[src]

Removes all sled trees Deletes everything in the db_dir

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AsAny for T where
    T: Any
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<D> OwoColorize for D

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,