pub struct SessionID(pub String);Tuple Fields§
§0: StringImplementations§
source§impl SessionID
impl SessionID
sourcepub fn create(
conn: &mut Connection,
user_id: Option<UserId>,
data: Option<Value>,
) -> Result<Self, Error>
pub fn create( conn: &mut Connection, user_id: Option<UserId>, data: Option<Value>, ) -> Result<Self, Error>
Create a new session entry with the given user ID. If the user ID is None, the session will be created without a user ID.
pub fn from_string<S: AsRef<str>>(s: S) -> Self
sourcepub fn set_user_id(
&self,
conn: &mut Connection,
user_id: UserId,
) -> Result<SessionID, Error>
pub fn set_user_id( &self, conn: &mut Connection, user_id: UserId, ) -> Result<SessionID, Error>
Set the user ID for the given session.
sourcepub fn data(&self, conn: &mut Connection) -> Result<SessionData, Error>
pub fn data(&self, conn: &mut Connection) -> Result<SessionData, Error>
Get the session data object. Useful for fetching the entire session data in a single db call. Use get_key instead if you only need a single key
sourcepub fn set_key<S: AsRef<str>, V: Serialize>(
&self,
conn: &mut Connection,
k: S,
v: V,
) -> Result<SessionID, SetKeyError>
pub fn set_key<S: AsRef<str>, V: Serialize>( &self, conn: &mut Connection, k: S, v: V, ) -> Result<SessionID, SetKeyError>
Directly store a key-value in the session store. This will overwrite the existing value for the given key if it exists. This is useful for storing a single key-value pair without fetching the entire session data
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SessionID
impl RefUnwindSafe for SessionID
impl Send for SessionID
impl Sync for SessionID
impl Unpin for SessionID
impl UnwindSafe for SessionID
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<T> IntoSql for T
impl<T> IntoSql for T
source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
Convert
self to an expression for Diesel’s query builder. Read moresource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
Convert
&self to an expression for Diesel’s query builder. Read more