pub struct Database { /* private fields */ }Implementations§
Source§impl Database
impl Database
pub async fn connect(url: &str, max_connections: u32) -> DbResult<Self>
pub async fn ping(&self) -> DbResult<()>
pub fn pool(&self) -> &SqlitePool
pub async fn create_user(&self, api_key: &str) -> DbResult<String>
pub async fn get_user_by_api_key( &self, api_key: &str, ) -> DbResult<Option<String>>
pub async fn create_library( &self, user_id: &str, name: &str, ) -> DbResult<String>
pub async fn list_libraries( &self, user_id: &str, limit: i32, offset: i32, ) -> DbResult<(Vec<Library>, i32)>
pub async fn delete_library( &self, user_id: &str, library_id: &str, ) -> DbResult<()>
pub async fn get_default_library(&self, user_id: &str) -> DbResult<String>
pub async fn verify_library_ownership( &self, user_id: &str, library_id: &str, ) -> DbResult<bool>
pub async fn get_snippets( &self, user_id: &str, library_id: &str, since: i64, limit: i32, offset: i32, include_deleted: bool, ) -> DbResult<(Vec<Snippet>, i32)>
pub async fn upsert_snippet_in_tx( &self, tx: &mut Transaction<'_, Sqlite>, snippet: &Snippet, user_id: &str, library_id: &str, ) -> DbResult<()>
pub async fn get_latest_timestamp( &self, user_id: &str, library_id: &str, ) -> DbResult<i64>
pub async fn migrate_plaintext_api_keys(&self) -> DbResult<usize>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Database
impl !UnwindSafe for Database
impl Freeze for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl UnsafeUnpin for Database
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request