Skip to content

Commit 8280807

Browse files
authored
Improve the comment on DataObjectOps::save (#350)
Relevant to #349
1 parent d8fe958 commit 8280807

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

butane_core/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,12 @@ pub trait DataObjectOps<T: DataObject> {
156156
.nth(0))
157157
}
158158

159-
/// Save the object to the database.
159+
/// Save the object to the database, handling both inserts and updates.
160+
///
161+
/// If the object has an AutoPk that is uninitialized, save will always
162+
/// perform an insert. If the AutoPk is initialized or there is no AutoPk,
163+
/// save will perform an upsert (insert or replace).
164+
/// After saving the main object, many-to-many relationships it holds are also saved.
160165
async fn save(&mut self, conn: &impl ConnectionMethods) -> Result<()>
161166
where
162167
Self: DataObject,

0 commit comments

Comments
 (0)