pub struct Note {Show 15 fields
pub id: Uuid,
pub namespace: String,
pub kind: String,
pub status: String,
pub name: Option<String>,
pub content: String,
pub salience: Option<f64>,
pub decay_factor: Option<f64>,
pub expires_at: Option<i64>,
pub properties: Option<Value>,
pub created_at: i64,
pub updated_at: i64,
pub deleted_at: Option<i64>,
pub key: Option<String>,
pub version: i64,
}Expand description
A storage-level note record. Flat, SQL-friendly representation.
Fields§
§id: Uuid§namespace: String§kind: String§status: String§name: Option<String>§content: String§salience: Option<f64>§decay_factor: Option<f64>§expires_at: Option<i64>§properties: Option<Value>§created_at: i64§updated_at: i64§deleted_at: Option<i64>§key: Option<String>Immutable caller-chosen identity, unique among live notes of the same namespace and kind.
version: i64Persisted revision, assigned by storage and advanced on every matched update.
Implementations§
Source§impl Note
impl Note
Sourcepub fn new(
namespace: impl Into<String>,
kind: impl Into<String>,
content: impl Into<String>,
) -> Self
pub fn new( namespace: impl Into<String>, kind: impl Into<String>, content: impl Into<String>, ) -> Self
Create a new note with a generated UUID and current timestamp.
Sourcepub fn with_salience(self, s: f64) -> Self
pub fn with_salience(self, s: f64) -> Self
Set salience (infallible). Rejects non-finite values by returning self
unchanged; clamps finite values to [0.0, 1.0]. Prefer
try_with_salience at public boundaries.
Sourcepub fn with_decay(self, d: f64) -> Self
pub fn with_decay(self, d: f64) -> Self
Set decay factor (infallible). Rejects non-finite values by returning
self unchanged; floors finite values at 0.0. Prefer
try_with_decay at public boundaries.
Sourcepub fn try_with_salience(self, s: f64) -> Result<Self, String>
pub fn try_with_salience(self, s: f64) -> Result<Self, String>
Set salience with validation. Returns an error for non-finite or
out-of-range [0.0, 1.0] values.
Sourcepub fn try_with_decay(self, d: f64) -> Result<Self, String>
pub fn try_with_decay(self, d: f64) -> Result<Self, String>
Set decay factor with validation. Returns an error for non-finite or negative values.
Sourcepub fn with_properties(self, p: Value) -> Self
pub fn with_properties(self, p: Value) -> Self
Set the note properties JSON blob.