MCPcopy Create free account
hub / github.com/AppFlowy-IO/AppFlowy-Collab / move_to

Method move_to

collab/src/database/views/view.rs:752–759  ·  view source on GitHub ↗

Move the object with the given id to the given position. If the object is not found, nothing will happen. If the position is out of range, nothing will happen.

(&self, txn: &mut TransactionMut, from_id: &str, to_id: &str)

Source from the content-addressed store, hash-verified

750 /// If the object is not found, nothing will happen.
751 /// If the position is out of range, nothing will happen.
752 fn move_to(&self, txn: &mut TransactionMut, from_id: &str, to_id: &str) -> Option<()> {
753 let from = self.get_position_with_txn(txn, from_id)?;
754 let to = self.get_position_with_txn(txn, to_id)?;
755 let to = if from < to { to + 1 } else { to };
756 trace!("Move object from {} to {}", from, to);
757 self.array_ref().move_to(txn, from, to);
758 None
759 }
760
761 /// Returns the position of the object with the given id.
762 fn get_position_with_txn<T: ReadTxn>(&self, txn: &T, id: &str) -> Option<u32> {

Callers 3

move_sortMethod · 0.45
move_row_orderMethod · 0.45
move_field_orderMethod · 0.45

Implementers 2

field_order.rscollab/src/database/views/field_order.
row_order.rscollab/src/database/views/row_order.rs

Calls 2

get_position_with_txnMethod · 0.80
array_refMethod · 0.45

Tested by

no test coverage detected