pub struct EntityIdExtractor;Expand description
Entity ID extractor for finding entity IDs in various contexts
Provides utilities for extracting entity IDs from field names, request paths, query parameters, and request bodies.
Implementations§
Source§impl EntityIdExtractor
impl EntityIdExtractor
Sourcepub fn from_field_name(field_name: &str) -> Option<String>
pub fn from_field_name(field_name: &str) -> Option<String>
Extract entity ID from a field name
Looks for common patterns like “user_id”, “device_id”, “transaction_id”, etc. Returns the field name if it matches a pattern, or None if no pattern matches.
Sourcepub fn from_path(path: &str) -> Option<(String, EntityType)>
pub fn from_path(path: &str) -> Option<(String, EntityType)>
Extract entity ID and type from a request path
Looks for path parameters like “/users/{user_id}” or “/devices/{device_id}”. Returns a tuple of (entity_id, entity_type) if found in the path.
Sourcepub fn from_path_id_only(path: &str) -> Option<String>
pub fn from_path_id_only(path: &str) -> Option<String>
Extract entity ID from a request path (backward compatibility)
Returns just the entity ID without type information.
Sourcepub fn from_json_value(value: &Value) -> Option<String>
pub fn from_json_value(value: &Value) -> Option<String>
Extract entity ID from a JSON value (request body or response)
Looks for common ID fields in the JSON object.