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

Add ForkedStore #6

Open
drewmccormack opened this issue Dec 15, 2024 · 0 comments
Open

Add ForkedStore #6

drewmccormack opened this issue Dec 15, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@drewmccormack
Copy link
Owner

ForkedResource is a basic building block which could be used to construct a full document store. For local storage, it could use SQLite.

Rather than splitting the model out over columns ala SwiftData, I would be inclined to use JSON encoding of the value, and store in a single column, more like a document store than a full ORM.

A macro would be added to control indexing, and any indexed property would also get its own column in the table. There is a little redundancy of data in this approach, but I think it is worth it.

Each type would get a table in the schema, and would also be required to have an identifier. (Not sure it should be tied to Identifiable or some other protocol.)

There would be an extra column to identify the fork that a value belongs to. So a single ForkedResource would map to several rows of the table. When fetching, you would read in all the values for that resource, generate a ForkedResource from that, and work with it in memory.

There would also need to be a column that indicates the role of the row in the fork. Eg. "Most Recent" or "Ancestor".

@drewmccormack drewmccormack added the enhancement New feature or request label Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant