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

Function insert_order_execute_sqlx

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

Source from the content-addressed store, hash-verified

177}
178
179async 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)]
213pub async fn insert_order(ex: &mut PgConnection, order: &Order) -> Result<(), sqlx::Error> {

Callers 2

insert_orderFunction · 0.85

Calls 3

queryFunction · 0.85
as_sliceMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected