Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ObjectState (breaking change) #151

Merged
merged 12 commits into from
Nov 1, 2023
Merged

Remove ObjectState (breaking change) #151

merged 12 commits into from
Nov 1, 2023

Conversation

Electron100
Copy link
Owner

ObjectState never really took on as large a role I had originally envisioned, while at the same time being quite clunky -- an extra field automatically injected into all model types. It had a single member saved, which tracks whether the object had previously been saved or not. Most of the time this doesn't matter though, especially since #117 changed save to upsert. I believe the only remaining case where it does matter is for automatic creation of primary keys, and those were operating in a semantic grey area where creating an unitialized primary key required setting it to -1 or similar.

This change does the following

  1. Removes ObjectState and the auto-created state member for each model
  2. Adds a new AutoPk<T> type which is used as the type for fields which represent automatic primary keys. This tracks whether the primary key has already been generated or not.

@Electron100 Electron100 mentioned this pull request Oct 23, 2023
@jayvdb jayvdb mentioned this pull request Oct 25, 2023
Electron100 pushed a commit that referenced this pull request Oct 30, 2023
Add docs to pub members that deepsource is complaining about at #151
@Electron100 Electron100 marked this pull request as ready for review October 30, 2023 01:00
Copy link
Collaborator

@jayvdb jayvdb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a few comments added, but overall this is awesome and lets get it in asap

@Electron100 Electron100 changed the title Draft: Remove ObjectState (breaking change) Remove ObjectState (breaking change) Nov 1, 2023
@Electron100 Electron100 merged commit 4c108bc into master Nov 1, 2023
@Electron100 Electron100 deleted the remove_state branch November 1, 2023 01:34
Electron100 pushed a commit that referenced this pull request Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants