Skip to content

Expose replace API endpoints #1979

Description

@Amir-61

Form @bajtos:

I'd like to discuss the naming scheme for these new methods (replaceOrCreate, replaceAttributes). I feel that replaceAttributes is not describing the intent precisely, and the difference between replaceAttributes and updateAttributes may not be clear enough.

At the moment, we have (among others):

  • MyModel.create
  • MyModel.updateOrCreate
  • myModelInstance.updateAttributes
  • myModelInstance.updateAttribute (a single attribute)

I am proposing to come up with new names while we are at adding support for REPLACE operations:

  • MyModel.create (remains same)
  • MyModel.patchOrCreate (with an alias MyModel.updateOrCreate for backwards-compatibility)
  • myModelInstance.patchAttributes (with an alias myModelInstance.updateAttributes for backwards-compatibility)
  • myModelInstance.updateAttribute
  • MyModel.replaceOrCreate
  • myModelInstance.replace or perhaps one of
    • myModelInstance.updateTo
    • myModelInstance.updateAllAttributes
    • myModelInstance.setTo

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions