Skip to content

Add upsert Method #14

@teles

Description

@teles

Add upsert Method

Description:

Introduce the upsert method to enable updating an existing record or inserting a new one if it does not exist, combining the functionalities of update and insert operations.

Objective:

  • Implement the upsert method that accepts parameters to identify the record and the data to update or insert.
  • Ensure the method performs the operation atomically.
  • Maintain data integrity during the operation.

Acceptance Criteria:

  • Calling upsert({ where: { id: 1 }, update: { ... }, data: { ... } }) updates the existing record.
  • Calling upsert({ where: { id: 999 }, update: { ... }, data: { ... } }) inserts a new record when no match is found.
  • Documentation and usage examples are included.
  • Automated tests cover both update and insert scenarios.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions