(
query_str: &str,
ex: &mut PgConnection,
order: &Order,
)
| 177 | } |
| 178 | |
| 179 | async fn insert_order_execute_sqlx( |
| 180 | query_str: &str, |
| 181 | ex: &mut PgConnection, |
| 182 | order: &Order, |
| 183 | ) -> Result<bool, sqlx::Error> { |
| 184 | sqlx::query(query_str) |
| 185 | .bind(order.uid) |
| 186 | .bind(order.owner) |
| 187 | .bind(order.creation_timestamp) |
| 188 | .bind(order.sell_token) |
| 189 | .bind(order.buy_token) |
| 190 | .bind(order.receiver) |
| 191 | .bind(&order.sell_amount) |
| 192 | .bind(&order.buy_amount) |
| 193 | .bind(order.valid_to) |
| 194 | .bind(order.app_data) |
| 195 | .bind(&order.fee_amount) |
| 196 | .bind(order.kind) |
| 197 | .bind(order.partially_fillable) |
| 198 | .bind(order.signature.as_slice()) |
| 199 | .bind(order.signing_scheme) |
| 200 | .bind(order.settlement_contract) |
| 201 | .bind(order.sell_token_balance) |
| 202 | .bind(order.buy_token_balance) |
| 203 | .bind(order.cancellation_timestamp) |
| 204 | .bind(order.class) |
| 205 | // true_valid_to takes the same value as valid_to when inserting an order |
| 206 | .bind(order.valid_to) |
| 207 | .execute(ex) |
| 208 | .await |
| 209 | .map(|result| result.rows_affected() > 0) |
| 210 | } |
| 211 | |
| 212 | #[instrument(skip_all)] |
| 213 | pub async fn insert_order(ex: &mut PgConnection, order: &Order) -> Result<(), sqlx::Error> { |
no test coverage detected