@@ -219,7 +219,7 @@ type RowInserter interface {
219
219
// is called.
220
220
Insert (* Context , Row ) error
221
221
// Close finalizes the insert operation, persisting its result.
222
- Close ( * Context ) error
222
+ Closer
223
223
}
224
224
225
225
// DeleteableTable is a table that can process the deletion of rows
@@ -236,13 +236,15 @@ type RowDeleter interface {
236
236
// Close is called.
237
237
Delete (* Context , Row ) error
238
238
// Close finalizes the delete operation, persisting the result.
239
- Close ( * Context ) error
239
+ Closer
240
240
}
241
241
242
242
type Closer interface {
243
243
Close (* Context ) error
244
244
}
245
245
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)
246
248
type RowReplacer interface {
247
249
// Insert inserts the row given, returning an error if it cannot. Insert will be called once for each row to process
248
250
// 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 {
253
255
// Close is called.
254
256
Delete (* Context , Row ) error
255
257
// Close finalizes the replace operation, persisting the result.
256
- Close ( * Context ) error
258
+ Closer
257
259
}
258
260
259
261
// Replacer allows rows to be replaced through a Delete (if applicable) then Insert.
@@ -270,11 +272,12 @@ type UpdatableTable interface {
270
272
Updater (ctx * Context ) RowUpdater
271
273
}
272
274
275
+ // RowUpdater is an update cursor that can update one or more rows in a table.
273
276
type RowUpdater interface {
274
277
// Update the given row. Provides both the old and new rows.
275
278
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
278
281
}
279
282
280
283
// Database represents the database.
0 commit comments