go-rel / go-rel/rel

Optimistic Locking

Open
#100 4 comments 0 reactions 0 assignees View on GitHub
hacktoberfest help wanted
Dominant language
Go
Stars
786
Forks
61
Avg merge
4d 11h
Merged PRs (30d)
2

Description

## Background

Optimistic locking (or optimistic concurrency control) is a technique that allows concurrent edits on a single record (more: https://hexdocs.pm/ecto/0.9.0/Ecto.Model.OptimisticLock.html)

## Implementation

- [ ] Detect Optimistic Locking enabled when a struct contains a `LockVersion int` field.
- [ ] Use `LockVersion` field whenever Update or Delete is performed to prevent operation on stale version of record. Maybe we can simply add additional where filter LockVersion=? on update or delete query.
- [ ] Differentiate error when updating/deleting stale record for non existent record.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.