pub struct SessionState {Show 16 fields
pub session_id: Uuid,
pub user: String,
pub database: String,
pub application_name: Option<String>,
pub client_encoding: String,
pub server_encoding: String,
pub timezone: String,
pub search_path: Vec<String>,
pub datestyle: String,
pub intervalstyle: String,
pub custom_parameters: HashMap<String, String>,
pub temp_tables: Vec<TempTableInfo>,
pub prepared_statements: HashMap<String, PreparedStatementInfo>,
pub created_at: DateTime<Utc>,
pub last_activity: DateTime<Utc>,
pub original_node: NodeId,
}Expand description
Session state information
Fields§
§session_id: UuidSession ID
user: StringUser name
database: StringDatabase name
application_name: Option<String>Application name
client_encoding: StringClient encoding
server_encoding: StringServer encoding
timezone: StringTimezone
search_path: Vec<String>Search path
datestyle: StringDateStyle
intervalstyle: StringIntervalStyle
custom_parameters: HashMap<String, String>Custom SET parameters
temp_tables: Vec<TempTableInfo>Session-local temporary tables
prepared_statements: HashMap<String, PreparedStatementInfo>Prepared statements
created_at: DateTime<Utc>Session created timestamp
last_activity: DateTime<Utc>Last activity timestamp
original_node: NodeIdOriginal node
Implementations§
Source§impl SessionState
impl SessionState
Sourcepub fn new(
session_id: Uuid,
user: String,
database: String,
node: NodeId,
) -> Self
pub fn new( session_id: Uuid, user: String, database: String, node: NodeId, ) -> Self
Create a new session state
Sourcepub fn set_parameter(&mut self, name: String, value: String)
pub fn set_parameter(&mut self, name: String, value: String)
Set a custom parameter
Sourcepub fn get_parameter(&self, name: &str) -> Option<String>
pub fn get_parameter(&self, name: &str) -> Option<String>
Get a parameter value
Sourcepub fn add_prepared_statement(&mut self, info: PreparedStatementInfo)
pub fn add_prepared_statement(&mut self, info: PreparedStatementInfo)
Add a prepared statement
Sourcepub fn remove_prepared_statement(&mut self, name: &str)
pub fn remove_prepared_statement(&mut self, name: &str)
Remove a prepared statement
Sourcepub fn add_temp_table(&mut self, info: TempTableInfo)
pub fn add_temp_table(&mut self, info: TempTableInfo)
Add a temp table
Sourcepub fn generate_restore_statements(&self) -> Vec<String>
pub fn generate_restore_statements(&self) -> Vec<String>
Generate SET statements to restore session
Trait Implementations§
Source§impl Clone for SessionState
impl Clone for SessionState
Source§fn clone(&self) -> SessionState
fn clone(&self) -> SessionState
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 SessionState
impl RefUnwindSafe for SessionState
impl Send for SessionState
impl Sync for SessionState
impl Unpin for SessionState
impl UnsafeUnpin for SessionState
impl UnwindSafe for SessionState
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