Struct mostro_core::order::Order

source ·
pub struct Order {
Show 33 fields pub id: Uuid, pub kind: String, pub event_id: String, pub hash: Option<String>, pub preimage: Option<String>, pub creator_pubkey: String, pub cancel_initiator_pubkey: Option<String>, pub buyer_pubkey: Option<String>, pub master_buyer_pubkey: Option<String>, pub seller_pubkey: Option<String>, pub master_seller_pubkey: Option<String>, pub status: String, pub price_from_api: bool, pub premium: i64, pub payment_method: String, pub amount: i64, pub min_amount: i64, pub max_amount: i64, pub buyer_dispute: bool, pub seller_dispute: bool, pub buyer_cooperativecancel: bool, pub seller_cooperativecancel: bool, pub fee: i64, pub routing_fee: i64, pub fiat_code: String, pub fiat_amount: i64, pub buyer_invoice: Option<String>, pub range_parent_id: Option<Uuid>, pub invoice_held_at: i64, pub taken_at: i64, pub created_at: i64, pub buyer_sent_rate: bool, pub seller_sent_rate: bool,
}
Expand description

Database representation of an order

Fields§

§id: Uuid§kind: String§event_id: String§hash: Option<String>§preimage: Option<String>§creator_pubkey: String§cancel_initiator_pubkey: Option<String>§buyer_pubkey: Option<String>§master_buyer_pubkey: Option<String>§seller_pubkey: Option<String>§master_seller_pubkey: Option<String>§status: String§price_from_api: bool§premium: i64§payment_method: String§amount: i64§min_amount: i64§max_amount: i64§buyer_dispute: bool§seller_dispute: bool§buyer_cooperativecancel: bool§seller_cooperativecancel: bool§fee: i64§routing_fee: i64§fiat_code: String§fiat_amount: i64§buyer_invoice: Option<String>§range_parent_id: Option<Uuid>§invoice_held_at: i64§taken_at: i64§created_at: i64§buyer_sent_rate: bool§seller_sent_rate: bool

Implementations§

Trait Implementations§

source§

impl Clone for Order

source§

fn clone(&self) -> Order

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'e> Crud<'e, &'e Pool<Sqlite>> for Order

source§

fn insert_binds( &'e self, query: QueryAs<'e, Sqlite, Self, <Sqlite as HasArguments<'e>>::Arguments> ) -> QueryAs<'e, Sqlite, Self, <Sqlite as HasArguments<'e>>::Arguments>

Given a query returns a new query with parameters suitable for an INSERT bound to it. The SqlxCrud implementation will bind the primary key, and each additional field to the query. Read more
source§

fn update_binds( &'e self, query: QueryAs<'e, Sqlite, Self, <Sqlite as HasArguments<'e>>::Arguments> ) -> QueryAs<'e, Sqlite, Self, <Sqlite as HasArguments<'e>>::Arguments>

Given a query returns a new query with parameters suitable for an UPDATE bound to it. The SqlxCrud implementation will bind every column except for the primary key followed by the primary key to the query. Read more
source§

fn create( &'e self, pool: E ) -> Pin<Box<dyn Future<Output = Result<Self, Error>> + 'e>>

Returns a future that resolves to an insert or sqlx::Error of the current instance. Read more
source§

fn all( pool: E ) -> TryCollect<Pin<Box<dyn Stream<Item = Result<Self, Error>> + Send + 'e>>, Vec<Self>>

Queries all records from the table and returns a future that returns to a try_collect stream, which resolves to a Vec<Self> or a sqlx::Error on error. Read more
source§

fn by_id( pool: E, id: Self::Id ) -> Pin<Box<dyn Future<Output = Result<Option<Self>, Error>> + 'e>>

Looks up a row by ID and returns a future that resolves an Option<Self>. Returns None if and a record with the corresponding ID cannot be found and Some if it exists. Read more
source§

fn update( &'e self, pool: E ) -> Pin<Box<dyn Future<Output = Result<Self, Error>> + 'e>>

Updates the database with the current instance state and returns a future that resolves an () on success and sqlx::Error on error. Read more
source§

fn delete( self, pool: E ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'e>>

Deletes a record from the database by ID and returns a future that resolves to () on success or sqlx::Error on failure. Read more
source§

impl Debug for Order

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Order

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<'a, R: Row> FromRow<'a, R> for Order
where &'a str: ColumnIndex<R>, Uuid: Decode<'a, R::Database> + Type<R::Database>, String: Decode<'a, R::Database> + Type<R::Database>, Option<String>: Decode<'a, R::Database> + Type<R::Database>, bool: Decode<'a, R::Database> + Type<R::Database>, i64: Decode<'a, R::Database> + Type<R::Database>, Option<Uuid>: Decode<'a, R::Database> + Type<R::Database>,

source§

fn from_row(row: &'a R) -> Result<Self>

source§

impl Schema for Order

§

type Id = Uuid

Type of the table primary key column.
source§

fn table_name() -> &'static str

Database name of the table. Used by the query generation code and available for introspection. This is generated by taking the plural snake_case of the struct’s name. See: Inflector to_table_case. Read more
source§

fn id(&self) -> Self::Id

Returns the id of the current instance.
source§

fn id_column() -> &'static str

Returns the column name of the primary key.
source§

fn columns() -> &'static [&'static str]

Returns an array of column names.
source§

fn select_sql() -> &'static str

Returns the SQL string for a SELECT query against the table. Read more
source§

fn select_by_id_sql() -> &'static str

Returns the SQL string for a SELECT query against the table with a WHERE clause for the primary key. Read more
source§

fn insert_sql() -> &'static str

Returns the SQL for inserting a new record in to the database. The #[external_id] attribute may be used to specify IDs are assigned outside of the database. Read more
source§

fn update_by_id_sql() -> &'static str

Returns the SQL for updating an existing record in the database. Read more
source§

fn delete_by_id_sql() -> &'static str

Returns the SQL for deleting an existing record by ID from the database. Read more
source§

impl Serialize for Order

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Order

§

impl Send for Order

§

impl Sync for Order

§

impl Unpin for Order

§

impl UnwindSafe for Order

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, 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

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.
§

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

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,