pub struct Transaction {
pub id: Uuid,
pub post_date: DateTime<Utc>,
pub enter_date: DateTime<Utc>,
}Expand description
The Transaction which is a start point of all the accounting.
A Transaction keeps id of a financial event and is used to group Splits
using all the features provided.
§Attributes
id: A unique identifier for the transaction.commodity: A reference to theCommodityassociated of this transaction.num: An optional number or code associated with the transaction.post_date: The date the transaction is performed.enter_date: The date the transaction is entered.description: An optional description of the transaction.
Fields§
§id: Uuid§post_date: DateTime<Utc>§enter_date: DateTime<Utc>Implementations§
Source§impl Transaction
impl Transaction
pub fn builder() -> TransactionBuilder
Source§impl<'t> Transaction
impl<'t> Transaction
Sourcepub async fn enter<'p, E>(
&'t self,
conn: &'p mut E,
) -> Result<TransactionTicket<'t, 'p>, FinanceError>where
E: Connection<Database = Postgres>,
pub async fn enter<'p, E>(
&'t self,
conn: &'p mut E,
) -> Result<TransactionTicket<'t, 'p>, FinanceError>where
E: Connection<Database = Postgres>,
Inserts the transaction into the database and starts data input.
This method begins a new database transaction, inserts the transaction
details into the DB, and returns a TransactionTicket to manage the
rest of data (Splits, Tags, and so on). The DB transaction must be
committed (or rolled back) from via the TransactionTicket returned.
§Parameters
conn: A connection to the database.
§Returns
A TransactionTicket for managing the transaction.
§Errors
Returns a FinanceError if the database operation fails.
Trait Implementations§
Source§impl Debug for Transaction
impl Debug for Transaction
Auto Trait Implementations§
impl Freeze for Transaction
impl RefUnwindSafe for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Unpin for Transaction
impl UnsafeUnpin for Transaction
impl UnwindSafe for Transaction
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
§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>
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