aboutsummaryrefslogtreecommitdiff
path: root/src/note.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/note.rs')
-rw-r--r--src/note.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/note.rs b/src/note.rs
new file mode 100644
index 0000000..ef38094
--- /dev/null
+++ b/src/note.rs
@@ -0,0 +1,36 @@
+//! The data model shared by all adapters and by the index.
+
+use serde::{Deserialize, Serialize};
+
+/// A link from one note to another. Types are optional.
+#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
+pub struct Link {
+ pub dst: String,
+ pub kind: Option<String>,
+}
+
+/// One note. A file is a container of notes; the note is the unit.
+#[derive(Clone, Debug, Serialize, Deserialize)]
+pub struct Note {
+ /// `None` for a note that has no ID yet; `check` reports these.
+ pub id: Option<String>,
+ pub path: String,
+ /// Byte span of the note inside its file.
+ pub start: usize,
+ pub end: usize,
+ /// 1-based line number of the first line of the note.
+ pub line: usize,
+ /// Hash of the span, used to detect changed notes.
+ pub hash: String,
+ pub title: String,
+ pub date: Option<String>,
+ pub kind: Option<String>,
+ pub tags: Vec<String>,
+ pub parent: Option<String>,
+ pub links: Vec<Link>,
+ pub context: Option<String>,
+ pub summary: Option<String>,
+ /// The text to index. It is never written to the manifest.
+ #[serde(skip)]
+ pub body: String,
+}