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

feat: huge refactor on persistent apis #70

Merged
merged 6 commits into from
May 31, 2021
Merged

Conversation

kiaking
Copy link
Member

@kiaking kiaking commented May 18, 2021

This PR adds many braking changes that refactors how persistent methods such as insert and update works.

Type of PR:

  • Bugfix
  • Feature
  • Refactor
  • Code style update
  • Build-related changes
  • Test
  • Documentation
  • Other, please describe:

Breaking changes:

  • No
  • Yes

Details

It contains following changes.

  • All persistent methods are now synchronous. Not async anymore.
  • All persistent methods returns either Model or Model[].
  • The save method is the only method that normalizes the given data. insert, fresh, update will not normalize data anymore.
  • Removing add, revise, replace method. Use insert, update, fresh instead.
  • the update method now only works with query constraints. userRepo.where('name', 'John').update({ name: 'Jane' }).

@kiaking kiaking added the enhancement New feature or request label May 18, 2021
@kiaking kiaking self-assigned this May 18, 2021
@codecov
Copy link

codecov bot commented May 31, 2021

Codecov Report

Merging #70 (0ebead6) into master (17d202d) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #70   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           36        36           
  Lines         1157      1122   -35     
  Branches       163       157    -6     
=========================================
- Hits          1157      1122   -35     
Impacted Files Coverage Δ
src/schema/Schema.ts 100.00% <ø> (ø)
src/connection/Connection.ts 100.00% <100.00%> (ø)
src/interpreter/Interpreter.ts 100.00% <100.00%> (ø)
src/modules/Mutations.ts 100.00% <100.00%> (ø)
src/query/Query.ts 100.00% <100.00%> (ø)
src/repository/Repository.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 17d202d...0ebead6. Read the comment docs.

@kiaking kiaking merged commit fe25477 into master May 31, 2021
@kiaking kiaking deleted the persist-api-refactor branch May 31, 2021 07:01
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

Successfully merging this pull request may close these issues.

None yet

1 participant