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

Function insert_order_execute_sqlx

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

Source from the content-addressed store, hash-verified

180}
181
182async fn insert_order_execute_sqlx(
183 query_str: &str,
184 ex: &mut PgConnection,
185 order: &Order,
186) -> Result<bool, sqlx::Error> {
187 sqlx::query(query_str)
188 .bind(order.uid)
189 .bind(order.owner)
190 .bind(order.creation_timestamp)
191 .bind(order.sell_token)
192 .bind(order.buy_token)
193 .bind(order.receiver)
194 .bind(&order.sell_amount)
195 .bind(&order.buy_amount)
196 .bind(order.valid_to)
197 .bind(order.app_data)
198 .bind(&order.fee_amount)
199 .bind(order.kind)
200 .bind(order.partially_fillable)
201 .bind(order.signature.as_slice())
202 .bind(order.signing_scheme)
203 .bind(order.settlement_contract)
204 .bind(order.sell_token_balance)
205 .bind(order.buy_token_balance)
206 .bind(order.cancellation_timestamp)
207 // true_valid_to takes the same value as valid_to when inserting an order
208 .bind(order.valid_to)
209 .bind(order.valid_from)
210 .bind(order.fast_path)
211 .bind(order.wait_for_cow)
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

as_sliceMethod · 0.80
queryFunction · 0.50
executeMethod · 0.45
bindMethod · 0.45

Tested by

no test coverage detected