pub struct UsersStore { /* private fields */ }Implementations§
Source§impl UsersStore
impl UsersStore
pub fn new(pool: Arc<Pool<SqliteConnectionManager>>) -> Self
pub fn initialize_schema(&self) -> Result<()>
pub fn create_user( &self, email: &str, name: &str, password_hash: &str, ) -> Result<i64>
Sourcepub fn upsert_google_user(
&self,
email: &str,
name: &str,
google_id: &str,
avatar_url: Option<&str>,
) -> Result<(User, bool)>
pub fn upsert_google_user( &self, email: &str, name: &str, google_id: &str, avatar_url: Option<&str>, ) -> Result<(User, bool)>
Create or update a Google OAuth user.
Logic:
- Look up by
google_id→ update name/avatar, return existing user - Look up by
email→ link Google account to existing user - Otherwise → create a new Google user (no password)
Returns
(User, is_new_user)whereis_new_useristrueonly when a brand-new account was created (Step 3 — never seen this Google ID or email).
pub fn get_user_by_email(&self, email: &str) -> Result<Option<User>>
pub fn get_user_by_id(&self, id: i64) -> Result<Option<User>>
pub fn verify_email(&self, token: &str) -> Result<Option<User>>
pub fn email_exists(&self, email: &str) -> Result<bool>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UsersStore
impl !RefUnwindSafe for UsersStore
impl Send for UsersStore
impl Sync for UsersStore
impl Unpin for UsersStore
impl UnsafeUnpin for UsersStore
impl !UnwindSafe for UsersStore
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