FolderEntity

Struct FolderEntity 

Source
pub struct FolderEntity<'conn, C>
where C: Deref<Target = Connection>,
{ /* private fields */ }
Expand description

Folder entity.

Implementations§

Source§

impl<'conn> FolderEntity<'conn, Box<Connection>>

Source

pub fn find_all_secrets_query() -> Select

Query to find all secrets in a folder.

Source

pub async fn compute_folder_vault( client: &Client, folder_id: &VaultId, ) -> Result<Vault, Error>

Compute the vault for a folder in the database.

Source§

impl<'conn> FolderEntity<'conn, Transaction<'conn>>

Source

pub async fn upsert_folder_and_secrets( client: &Client, account_id: i64, vault: &Vault, ) -> Result<(i64, HashMap<SecretId, i64>), Error>

Create a folder and the secrets in a vault.

If a folder with the same identifier already exists it is updated and any existing secrets are deleted before inserting the new collection of secrets in the vault.

Source

pub async fn replace_all_secrets( client: Client, folder_id: &VaultId, vault: &Vault, ) -> Result<(), Error>

Replace all secrets for a folder using a transaction.

Source§

impl<'conn, C> FolderEntity<'conn, C>
where C: Deref<Target = Connection>,

Source

pub fn new(conn: &'conn C) -> Self

Create a new folder entity.

Source

pub fn find_one(&self, folder_id: &VaultId) -> StdResult<FolderRow, SqlError>

Find a folder in the database.

Source

pub fn find_optional( &self, folder_id: &VaultId, ) -> StdResult<Option<FolderRow>, SqlError>

Find an optional folder in the database.

Source

pub fn find_by_row_id(&self, folder_id: i64) -> StdResult<FolderRow, SqlError>

Find a folder in the database by primary key.

Source

pub fn find_login_folder(&self, account_id: i64) -> Result<FolderRow, Error>

Try to find a login folder for an account.

Source

pub fn find_login_folder_optional( &self, account_id: i64, ) -> StdResult<Option<FolderRow>, SqlError>

Try to find an optional login folder for an account.

Source

pub fn find_device_folder( &self, account_id: i64, ) -> StdResult<Option<FolderRow>, SqlError>

Try to find a device folder for an account.

Source

pub fn list_user_folders( &self, account_id: i64, ) -> Result<Vec<FolderRow>, Error>

List user folders for an account.

Does not include the identity and device folders.

Source

pub fn update_name(&self, folder_id: &VaultId, name: &str) -> Result<(), Error>

Update the name of a folder.

Source

pub fn update_flags( &self, folder_id: &VaultId, flags: &VaultFlags, ) -> Result<(), Error>

Update the folder flags.

Source

pub fn update_meta(&self, folder_id: &VaultId, meta: &[u8]) -> Result<(), Error>

Update the folder meta data.

Source

pub fn insert_folder( &self, account_id: i64, folder_row: &FolderRow, ) -> StdResult<i64, SqlError>

Create the folder entity in the database.

Source

pub fn update_folder( &self, folder_id: &VaultId, folder_row: &FolderRow, ) -> StdResult<(), SqlError>

Update the folder entity in the database.

Source

pub fn insert_folder_secrets( &self, folder_id: i64, rows: &[SecretRow], ) -> Result<HashMap<SecretId, i64>, Error>

Create folder secret rows.

Source

pub fn insert_secret( &self, folder_id: &VaultId, secret_row: &SecretRow, ) -> StdResult<i64, SqlError>

Create folder secret.

Source

pub fn insert_secret_by_row_id( &self, folder_id: i64, secret_row: &SecretRow, ) -> StdResult<i64, SqlError>

Insert a secret using the folder row id.

Source

pub fn find_secret( &self, folder_id: &VaultId, secret_id: &SecretId, ) -> StdResult<Option<SecretRow>, SqlError>

Find a folder secret.

Source

pub fn update_secret( &self, folder_id: &VaultId, secret_row: &SecretRow, ) -> Result<bool, Error>

Update a folder secret.

Source

pub fn load_secrets(&self, folder_row_id: i64) -> Result<Vec<SecretRow>, Error>

Load secret rows.

Source

pub fn list_secret_ids( &self, folder_id: &VaultId, ) -> Result<Vec<SecretId>, Error>

List secret ids.

Source

pub fn delete_folder(&self, folder_id: &VaultId) -> StdResult<bool, SqlError>

Delete a folder.

Source

pub fn delete_secret( &self, folder_id: &VaultId, secret_id: &SecretId, ) -> StdResult<bool, SqlError>

Delete folder secret.

Auto Trait Implementations§

§

impl<'conn, C> Freeze for FolderEntity<'conn, C>

§

impl<'conn, C> RefUnwindSafe for FolderEntity<'conn, C>
where C: RefUnwindSafe,

§

impl<'conn, C> Send for FolderEntity<'conn, C>
where C: Sync,

§

impl<'conn, C> Sync for FolderEntity<'conn, C>
where C: Sync,

§

impl<'conn, C> Unpin for FolderEntity<'conn, C>

§

impl<'conn, C> UnwindSafe for FolderEntity<'conn, C>
where C: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more