pub struct Payee {
pub id: PayeeId,
pub name: String,
pub default_category_id: Option<CategoryId>,
pub category_frequency: HashMap<CategoryId, u32>,
pub manual: bool,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
A payee with auto-categorization rules
Fields§
§id: PayeeIdUnique identifier
name: StringPayee name
default_category_id: Option<CategoryId>Default category for new transactions with this payee
category_frequency: HashMap<CategoryId, u32>Category usage frequency for learning (category_id -> count)
manual: boolWhether this payee was manually created vs auto-created from transaction
created_at: DateTime<Utc>When the payee was created
updated_at: DateTime<Utc>When the payee was last modified
Implementations§
Source§impl Payee
impl Payee
Sourcepub fn with_default_category(
name: impl Into<String>,
category_id: CategoryId,
) -> Self
pub fn with_default_category( name: impl Into<String>, category_id: CategoryId, ) -> Self
Create a manually-created payee with a default category
Sourcepub fn record_category_usage(&mut self, category_id: CategoryId)
pub fn record_category_usage(&mut self, category_id: CategoryId)
Record a category usage for learning
Sourcepub fn suggested_category(&self) -> Option<CategoryId>
pub fn suggested_category(&self) -> Option<CategoryId>
Get the suggested category (default or most frequent)
Sourcepub fn set_default_category(&mut self, category_id: CategoryId)
pub fn set_default_category(&mut self, category_id: CategoryId)
Set the default category manually
Sourcepub fn clear_default_category(&mut self)
pub fn clear_default_category(&mut self)
Clear the default category
Sourcepub fn validate(&self) -> Result<(), PayeeValidationError>
pub fn validate(&self) -> Result<(), PayeeValidationError>
Validate the payee
Sourcepub fn normalize_name(name: &str) -> String
pub fn normalize_name(name: &str) -> String
Normalize a payee name for matching
Sourcepub fn matches_name(&self, name: &str) -> bool
pub fn matches_name(&self, name: &str) -> bool
Check if this payee matches a name (case-insensitive)
Sourcepub fn similarity_score(&self, query: &str) -> f64
pub fn similarity_score(&self, query: &str) -> f64
Calculate similarity score for fuzzy matching (0.0 to 1.0)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Payee
impl<'de> Deserialize<'de> for Payee
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Payee
impl RefUnwindSafe for Payee
impl Send for Payee
impl Sync for Payee
impl Unpin for Payee
impl UnwindSafe for Payee
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more