[−][src]Struct db::clients::ClientHandler
Holds utilities to maniuplate the Client table in the database
Methods
impl ClientHandler
[src]
pub fn upsert(
&self,
conn: &PgConnection,
new_client: &Client
) -> QueryResult<Client>
[src]
&self,
conn: &PgConnection,
new_client: &Client
) -> QueryResult<Client>
Attempts to insert a new client with UID, if there is a conflic, it will update the record.
pub fn upsert_batch(
&self,
conn: &PgConnection,
clients: ClientVector
) -> QueryResult<()>
[src]
&self,
conn: &PgConnection,
clients: ClientVector
) -> QueryResult<()>
Attempts to insert a new client with UID, if there is a conflic,
it will update the record. Doesn't work quite as expected.. Followed the
guides from here
but doesn't seem to actually set
the excluded value where the conflict happened..
pub fn remove_uid(&self, conn: &PgConnection, id: UID) -> QueryResult<usize>
[src]
Permanently remove record from table, by UID
pub fn remove_uids(
&self,
conn: &PgConnection,
uids: Vec<UID>
) -> QueryResult<usize>
[src]
&self,
conn: &PgConnection,
uids: Vec<UID>
) -> QueryResult<usize>
Remove a list of UIDS from db by suppling a vec of UIDs careful if supplied vector is empty, it will remove all records in table
pub fn uid_exists(&self, conn: &PgConnection, id: UID) -> bool
[src]
checks to see if UID of client exists within database
pub fn get_uid(&self, conn: &PgConnection, id: UID) -> QueryResult<ClientVector>
[src]
Get single UID from db, if UID doesn't exist it will return an empty vector
pub fn get_uids(
&self,
conn: &PgConnection,
uids: Vec<UID>
) -> QueryResult<ClientVector>
[src]
&self,
conn: &PgConnection,
uids: Vec<UID>
) -> QueryResult<ClientVector>
Retrieve a list of UIDS from db by suppling a vec of UIDs if an empty set of uids is supplied, it will retrieve all records in table
pub fn get_uids_range(
&self,
conn: &PgConnection,
from: UID,
to: UID
) -> QueryResult<ClientVector>
[src]
&self,
conn: &PgConnection,
from: UID,
to: UID
) -> QueryResult<ClientVector>
Get a range of UIDs Note that UIDS that do not exists will be logged, but will not show up in the returned vector
pub fn get_ip_exact<'a>(
&self,
conn: &PgConnection,
ip: &'a str
) -> QueryResult<ClientVector>
[src]
&self,
conn: &PgConnection,
ip: &'a str
) -> QueryResult<ClientVector>
retrieve records with exact IP address
pub fn get_ip_like<'a>(
&self,
conn: &PgConnection,
pattern_match: String
) -> QueryResult<ClientVector>
[src]
&self,
conn: &PgConnection,
pattern_match: String
) -> QueryResult<ClientVector>
retrieve a vector of ip address with the appropriate match pattern provided
let pattern = format!("%{}%", "168.0"); // vector of Clients objects with ips matching `*168.0*` let results = ClientHandler::get_ip_like(&conn, pattern);
Auto Trait Implementations
impl RefUnwindSafe for ClientHandler
impl Send for ClientHandler
impl Sync for ClientHandler
impl Unpin for ClientHandler
impl UnwindSafe for ClientHandler
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoSql for T
fn into_sql<T>(self) -> Self::Expression where
Self: AsExpression<T>,
Self: AsExpression<T>,
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression where
&'a Self: AsExpression<T>,
&'a Self: AsExpression<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,