[GODRIVER-2703] Remove all setters from the "operation" package operation types Created: 16/Dec/22  Updated: 22/Dec/22

Status: Backlog
Project: Go Driver
Component/s: CRUD
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Unknown
Reporter: Matt Dale Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: techdebt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

All operation structs in the x/mongo/driver/operation package currently use the "chainable setter" pattern to configure operations. However, those APIs are not currently intended for use outside of the Go driver and none of those setters contain any additional logic (i.e. just set the passed-in value). As a result, the setters do not deliver additional value and are just additional code to maintain. Remove all setter functions from the x/mongo/driver/operation operation structs and export all operation struct fields.

Definition of done:

  • Remove all "chainable setter" functions from the x/mongo/driver/operation operation structs.
  • Export all fields in the x/mongo/driver/operation operation structs.
  • (Optional) Consider removing the Result field from all operation structs and make it a return value or output argument from the [operationType].Execute function. Note that this may require using Go generics, so may only be possible in Go Driver 2.x.
  • (Optional) Consider removing all fields from operation structs except those that are required to implement the operation type's Execute function. All other fields would be set directly on a driver.Operation in the CRUD API.

Generated at Thu Feb 08 08:39:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.