pub struct IDValidationProfile {
pub name: String,
pub validator: ValidationProfileType,
}Expand description
ID validation profile for different use cases
Profiles provide preset ID validation configurations for common scenarios. Each profile includes a name and a validator instance.
§Built-in Profiles
- UUID: Strict UUID format validation (FraiseQL default)
- Numeric: Integer-based IDs (suitable for sequential IDs)
- ULID: Sortable unique identifiers (recommended for distributed systems)
- Opaque: Any string accepted (GraphQL spec compliant)
Fields§
§name: StringProfile name (e.g., “uuid”, “ulid”, “numeric”)
validator: ValidationProfileTypeValidator instance for this profile
Implementations§
Source§impl IDValidationProfile
impl IDValidationProfile
Sourcepub fn by_name(name: &str) -> Option<Self>
pub fn by_name(name: &str) -> Option<Self>
Get profile by name
Returns a profile matching the given name, or None if not found.
§Built-in Profile Names
- “uuid” - UUID validation
- “numeric” - Integer validation
- “ulid” - ULID validation
- “opaque” - Any string validation
Sourcepub fn validate(&self, value: &str) -> Result<(), IDValidationError>
pub fn validate(&self, value: &str) -> Result<(), IDValidationError>
Validate an ID using this profile.
§Errors
Returns IDValidationError if the value does not conform to this
profile’s validator (e.g., not a valid UUID, ULID, or integer).
Trait Implementations§
Source§impl Clone for IDValidationProfile
impl Clone for IDValidationProfile
Source§fn clone(&self) -> IDValidationProfile
fn clone(&self) -> IDValidationProfile
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for IDValidationProfile
impl RefUnwindSafe for IDValidationProfile
impl Send for IDValidationProfile
impl Sync for IDValidationProfile
impl Unpin for IDValidationProfile
impl UnsafeUnpin for IDValidationProfile
impl UnwindSafe for IDValidationProfile
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more