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

Refactor Repository #59

Merged
merged 4 commits into from
Sep 27, 2024
Merged

Refactor Repository #59

merged 4 commits into from
Sep 27, 2024

Conversation

georgeef
Copy link
Contributor

@georgeef georgeef commented Sep 27, 2024

Structure:

  • DataManager contains db: Connection?, which is the main (only) database handle.

  • DataManager provides functions to open a database, create a new database, create a sample database.

  • Views access the database through @EnvironmentObject dataManager.

  • dataManager.repository returns a Repository?, which represents the whole database and encapsulates a few details of database access.

  • dataManager.<T>Repository returns a <T>Repository?, which represents table <T> and encapsulates the database access to a single table.

  • Repository and <T>Repository contain db: Connection, which is not optional. For convenience, there are initializers for an optional db, which return Repository? and <T>Repository?.

@guanlisheng guanlisheng merged commit 47ac27d into master Sep 27, 2024
1 check passed
@georgeef georgeef deleted the refactor_repository branch September 29, 2024 13:56
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