@@ -219,7 +219,7 @@ type RowInserter interface {
219219 // is called.
220220 Insert (* Context , Row ) error
221221 // Close finalizes the insert operation, persisting its result.
222- Close ( * Context ) error
222+ Closer
223223}
224224
225225// DeleteableTable is a table that can process the deletion of rows
@@ -236,13 +236,15 @@ type RowDeleter interface {
236236 // Close is called.
237237 Delete (* Context , Row ) error
238238 // Close finalizes the delete operation, persisting the result.
239- Close ( * Context ) error
239+ Closer
240240}
241241
242242type Closer interface {
243243 Close (* Context ) error
244244}
245245
246+ // RowReplacer is a combination of RowDeleter and RowInserter. We can't embed those interfaces because go doesn't allow
247+ // for overlapping interfaces (they both declare Close)
246248type RowReplacer interface {
247249 // Insert inserts the row given, returning an error if it cannot. Insert will be called once for each row to process
248250 // for the replace operation, which may involve many rows. After all rows in an operation have been processed, Close
@@ -253,7 +255,7 @@ type RowReplacer interface {
253255 // Close is called.
254256 Delete (* Context , Row ) error
255257 // Close finalizes the replace operation, persisting the result.
256- Close ( * Context ) error
258+ Closer
257259}
258260
259261// Replacer allows rows to be replaced through a Delete (if applicable) then Insert.
@@ -270,11 +272,12 @@ type UpdatableTable interface {
270272 Updater (ctx * Context ) RowUpdater
271273}
272274
275+ // RowUpdater is an update cursor that can update one or more rows in a table.
273276type RowUpdater interface {
274277 // Update the given row. Provides both the old and new rows.
275278 Update (ctx * Context , old Row , new Row ) error
276- // Close finalizes the delete operation, persisting the result.
277- Close ( * Context ) error
279+ // Close finalizes the update operation, persisting the result.
280+ Closer
278281}
279282
280283// Database represents the database.
0 commit comments