pub struct ScrapDoorRepository;Expand description
The scrap door’s mint/probe/close SQL. Stateless — every method takes the caller’s connection so the header insert and the later done-stamp run under the caller’s scope.
Implementations§
Source§impl ScrapDoorRepository
impl ScrapDoorRepository
pub fn new() -> Self
Sourcepub async fn insert_scrap(
&self,
conn: &mut PgConnection,
s: &NewScrapRow<'_>,
) -> Result<(), Error>
pub async fn insert_scrap( &self, conn: &mut PgConnection, s: &NewScrapRow<'_>, ) -> Result<(), Error>
Insert the scrap header (draft). Leaks the raw sqlx::Error deliberately so the
service can turn a unique violation on the name — the composing decorator’s org-scoped
arbiter — into the typed duplicate error.
Sourcepub async fn fetch_scrap(
&self,
conn: &mut PgConnection,
scrap_id: Uuid,
) -> Result<Option<ScrapRow>, Error>
pub async fn fetch_scrap( &self, conn: &mut PgConnection, scrap_id: Uuid, ) -> Result<Option<ScrapRow>, Error>
Read one scrap header (probe surface).
Sourcepub async fn mark_scrap_done(
&self,
conn: &mut PgConnection,
scrap_id: Uuid,
move_id: Uuid,
) -> Result<bool, Error>
pub async fn mark_scrap_done( &self, conn: &mut PgConnection, scrap_id: Uuid, move_id: Uuid, ) -> Result<bool, Error>
The terminal close: stamp the scrap done and bind the engine move it landed
through. The AND state = 'draft' guard is the concurrency backstop — exactly one
racer transitions; the other sees false and re-reads the header as done.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ScrapDoorRepository
impl RefUnwindSafe for ScrapDoorRepository
impl Send for ScrapDoorRepository
impl Sync for ScrapDoorRepository
impl Unpin for ScrapDoorRepository
impl UnsafeUnpin for ScrapDoorRepository
impl UnwindSafe for ScrapDoorRepository
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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