pub struct User {
pub id: Uuid,
}Fields§
§id: UuidImplementations§
Source§impl User
impl User
pub async fn add_account(&self, script: &[u8]) -> Result<Account, ServerError>
pub async fn create_account( &self, name: &str, parent: Option<Uuid>, ) -> Result<Account, ServerError>
pub async fn set_account_tag( &self, a: &Account, t: &Tag, ) -> Result<(), ServerError>
pub async fn list_transaction_ids_by_account( &self, account_id: Uuid, ) -> Result<Vec<Uuid>, ServerError>
pub async fn get_account_tag( &self, a: &Account, tag: &String, ) -> Result<Tag, ServerError>
Source§impl User
impl User
pub async fn list_scripts(&self) -> Result<Vec<ScriptInfo>, ServerError>
pub async fn get_script(&self, id: Uuid) -> Result<ScriptDetail, ServerError>
pub async fn create_script( &self, bytecode: Vec<u8>, name: Option<String>, ) -> Result<Uuid, ServerError>
pub async fn update_script_bytecode( &self, id: Uuid, bytecode: Vec<u8>, ) -> Result<(), ServerError>
pub async fn delete_script(&self, id: Uuid) -> Result<(), ServerError>
pub async fn set_script_enabled( &self, id: Uuid, enabled: bool, ) -> Result<(), ServerError>
pub async fn update_script_name( &self, id: Uuid, name: Option<String>, ) -> Result<(), ServerError>
pub async fn list_templates(&self) -> Result<Vec<TemplateInfo>, ServerError>
pub async fn get_template( &self, id: Uuid, ) -> Result<TemplateDetail, ServerError>
pub async fn create_template( &self, source: String, name: Option<String>, ) -> Result<Uuid, ServerError>
pub async fn update_template_source( &self, id: Uuid, source: String, ) -> Result<(), ServerError>
pub async fn delete_template(&self, id: Uuid) -> Result<(), ServerError>
pub async fn update_template_name( &self, id: Uuid, name: Option<String>, ) -> Result<(), ServerError>
Source§impl User
impl User
pub async fn add_commodity( &self, script: &[u8], ) -> Result<Commodity, ServerError>
pub async fn create_commodity( &self, symbol: String, name: String, ) -> Result<Commodity, ServerError>
pub async fn set_commodity_tag( &self, c: &Commodity, t: &Tag, ) -> Result<(), ServerError>
pub async fn get_commodity_tag( &self, c: &Commodity, tag: &String, ) -> Result<Tag, ServerError>
Source§impl User
impl User
pub async fn create_tag( &self, name: String, value: String, description: Option<String>, ) -> Result<Uuid, ServerError>
pub async fn get_tag(&self, id: Uuid) -> Result<Tag, ServerError>
pub async fn update_tag( &self, id: Uuid, name: String, value: String, description: Option<String>, ) -> Result<(), ServerError>
pub async fn create_transaction_tag( &self, tx_id: Uuid, name: String, value: String, description: Option<String>, ) -> Result<Uuid, ServerError>
Sourcepub async fn delete_tag(&self, id: Uuid) -> Result<(), ServerError>
pub async fn delete_tag(&self, id: Uuid) -> Result<(), ServerError>
Cascade-delete a tag: detach from every join table, then drop the
row from tags. Used by user-initiated tag deletion in the UI;
see detach_*_tag + cleanup_orphan_tag for the
“remove from one entity, drop only if no longer referenced”
pattern.
pub async fn detach_transaction_tag( &self, tx_id: Uuid, tag_id: Uuid, ) -> Result<(), ServerError>
pub async fn detach_split_tag( &self, split_id: Uuid, tag_id: Uuid, ) -> Result<(), ServerError>
pub async fn detach_account_tag( &self, account_id: Uuid, tag_id: Uuid, ) -> Result<(), ServerError>
pub async fn detach_commodity_tag( &self, commodity_id: Uuid, tag_id: Uuid, ) -> Result<(), ServerError>
Sourcepub async fn cleanup_orphan_tag(&self, tag_id: Uuid) -> Result<(), ServerError>
pub async fn cleanup_orphan_tag(&self, tag_id: Uuid) -> Result<(), ServerError>
If tag_id is no longer referenced by any join table, delete the
canonical row. Idempotent.
pub async fn list_tag_names( &self, scope: TagScope, ) -> Result<Vec<String>, ServerError>
pub async fn list_tag_values_for( &self, scope: TagScope, tag_name: &str, ) -> Result<Vec<String>, ServerError>
pub async fn list_transaction_tag_names( &self, ) -> Result<Vec<String>, ServerError>
pub async fn list_transaction_tag_values( &self, tag_name: &str, ) -> Result<Vec<String>, ServerError>
pub async fn create_split_tag( &self, split_id: Uuid, name: String, value: String, description: Option<String>, ) -> Result<Uuid, ServerError>
Sourcepub async fn set_split_tag(
&self,
split_id: Uuid,
t: &Tag,
) -> Result<(), ServerError>
pub async fn set_split_tag( &self, split_id: Uuid, t: &Tag, ) -> Result<(), ServerError>
Upsert-style set: replace any existing (split, tag_name) link with
the (tag_name, tag_value) pair from t. Mirrors set_account_tag
— script-friendly idempotent set semantics.
Sourcepub async fn set_transaction_tag(
&self,
tx_id: Uuid,
t: &Tag,
) -> Result<(), ServerError>
pub async fn set_transaction_tag( &self, tx_id: Uuid, t: &Tag, ) -> Result<(), ServerError>
Companion to set_split_tag for transactions.
Read all tags attached to a single split. Parallel to
get_transaction_tags; the script-side get-split-tag native
looks up by name in the returned vec.
pub async fn create_account_tag( &self, account_id: Uuid, name: String, value: String, description: Option<String>, ) -> Result<Uuid, ServerError>
pub async fn list_account_tag_names(&self) -> Result<Vec<String>, ServerError>
pub async fn list_account_tag_values( &self, tag_name: &str, ) -> Result<Vec<String>, ServerError>
pub async fn list_split_tag_names(&self) -> Result<Vec<String>, ServerError>
pub async fn list_split_tag_values( &self, tag_name: &str, ) -> Result<Vec<String>, ServerError>
Source§impl User
impl User
pub async fn get_connection(&self) -> Result<PoolConnection<Postgres>, DBError>
Sourcepub async fn config(
&self,
field: &str,
) -> Result<Option<ConfigOption>, ConfigError>
pub async fn config( &self, field: &str, ) -> Result<Option<ConfigOption>, ConfigError>
Reads a config field from THIS user’s database. Per-user config is
isolated to the user’s own DB (distinct from server-wide
crate::config::system_config).
§Errors
ConfigError::DB on a connection or query error.
Sourcepub async fn set_config(
&self,
field: &str,
contents: ConfigOption,
) -> Result<(), ConfigError>
pub async fn set_config( &self, field: &str, contents: ConfigOption, ) -> Result<(), ConfigError>
Writes a config field to THIS user’s database.
§Errors
ConfigError::DB on a connection or query error.
Auto Trait Implementations§
impl Freeze for User
impl RefUnwindSafe for User
impl Send for User
impl Sync for User
impl Unpin for User
impl UnsafeUnpin for User
impl UnwindSafe for User
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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