MCPcopy Create free account
hub / github.com/cowprotocol/services / insert_order_execute_sqlx

Function insert_order_execute_sqlx

crates/database/src/orders.rs:183–215  ·  view source on GitHub ↗
(
    query_str: &str,
    ex: &mut PgConnection,
    order: &Order,
)

Source from the content-addressed store, hash-verified

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

Callers 2

insert_orderFunction · 0.85

Calls 4

queryFunction · 0.85
bindMethod · 0.80
as_sliceMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected