pub trait AnalyticsStore: Send + Sync {
// Required methods
fn record(&self, event: SelectionEvent) -> Result<(), LearnError>;
fn query_recent(
&self,
limit: usize,
) -> Result<Vec<SelectionEvent>, LearnError>;
fn query_by_skill(
&self,
skill: &SkillName,
limit: usize,
) -> Result<Vec<SelectionEvent>, LearnError>;
fn count(&self) -> Result<usize, LearnError>;
}Expand description
Trait for analytics storage backends.
Required Methods§
Sourcefn record(&self, event: SelectionEvent) -> Result<(), LearnError>
fn record(&self, event: SelectionEvent) -> Result<(), LearnError>
Record a selection event.
Sourcefn query_recent(&self, limit: usize) -> Result<Vec<SelectionEvent>, LearnError>
fn query_recent(&self, limit: usize) -> Result<Vec<SelectionEvent>, LearnError>
Query recent events.
Sourcefn query_by_skill(
&self,
skill: &SkillName,
limit: usize,
) -> Result<Vec<SelectionEvent>, LearnError>
fn query_by_skill( &self, skill: &SkillName, limit: usize, ) -> Result<Vec<SelectionEvent>, LearnError>
Query events for a specific skill.
Sourcefn count(&self) -> Result<usize, LearnError>
fn count(&self) -> Result<usize, LearnError>
Get event count.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl AnalyticsStore for InMemoryAnalyticsStore
impl AnalyticsStore for SqliteAnalyticsStore
Available on crate feature
analytics-sqlite only.