pub struct BaseController;Expand description
Base controller providing HTTP utilities (no infrastructure dependencies)
Implementations§
Source§impl BaseController
impl BaseController
pub fn new() -> Self
Sourcepub fn normalize_pagination(&self, params: &QueryParams) -> (u32, u32, u64)
pub fn normalize_pagination(&self, params: &QueryParams) -> (u32, u32, u64)
Validate and normalize pagination parameters
Sourcepub fn success_response<T: Serialize>(&self, data: T) -> HttpResult<Response>
pub fn success_response<T: Serialize>(&self, data: T) -> HttpResult<Response>
Create standardized success response
Sourcepub fn created_response<T: Serialize>(&self, data: T) -> HttpResult<Response>
pub fn created_response<T: Serialize>(&self, data: T) -> HttpResult<Response>
Create standardized created response
Sourcepub fn paginated_response<T: Serialize>(
&self,
data: Vec<T>,
meta: PaginationMeta,
) -> HttpResult<Response>
pub fn paginated_response<T: Serialize>( &self, data: Vec<T>, meta: PaginationMeta, ) -> HttpResult<Response>
Create paginated response with metadata
Sourcepub fn deleted_response<T: Serialize>(
&self,
resource_name: &str,
deleted_id: Option<T>,
) -> HttpResult<Response>
pub fn deleted_response<T: Serialize>( &self, resource_name: &str, deleted_id: Option<T>, ) -> HttpResult<Response>
Create standardized delete response
Trait Implementations§
Source§impl Clone for BaseController
impl Clone for BaseController
Source§fn clone(&self) -> BaseController
fn clone(&self) -> BaseController
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 BaseController
impl RefUnwindSafe for BaseController
impl Send for BaseController
impl Sync for BaseController
impl Unpin for BaseController
impl UnwindSafe for BaseController
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