Struct mostro_core::order::Order

source ·
pub struct Order {
Show 16 fields pub id: Uuid, pub kind: String, pub event_id: String, pub hash: Option<String>, pub preimage: Option<String>, pub creator_pubkey: String, pub buyer_pubkey: Option<String>, pub seller_pubkey: Option<String>, pub status: String, pub prime: i64, pub payment_method: String, pub amount: i64, pub fiat_code: String, pub fiat_amount: i64, pub buyer_invoice: Option<String>, pub created_at: i64,
}

Fields§

§id: Uuid§kind: String§event_id: String§hash: Option<String>§preimage: Option<String>§creator_pubkey: String§buyer_pubkey: Option<String>§seller_pubkey: Option<String>§status: String§prime: i64§payment_method: String§amount: i64§fiat_code: String§fiat_amount: i64§buyer_invoice: Option<String>§created_at: i64

Implementations§

Trait Implementations§

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

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, Global>>, Vec<Self, Global>>

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

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

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

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 Orderwhere &'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>, i64: 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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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<T> for T

§

type Output = T

Should always be Self
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

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

§

fn vzip(self) -> V

source§

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