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 Save() method #36

Merged
merged 10 commits into from
Apr 26, 2022
Merged

Add Save() method #36

merged 10 commits into from
Apr 26, 2022

Conversation

dbgjerez
Copy link
Contributor

No description provided.

storage.go Outdated Show resolved Hide resolved
db.go Outdated Show resolved Hide resolved
db.go Outdated Show resolved Hide resolved
db.go Outdated Show resolved Hide resolved
db_test.go Outdated Show resolved Hide resolved
db_test.go Outdated Show resolved Hide resolved
db_test.go Outdated Show resolved Hide resolved
db_test.go Outdated Show resolved Hide resolved
Copy link
Owner

@ostafen ostafen left a comment

Choose a reason for hiding this comment

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

Hi, @dbgjerez, thanks for the PR. I highlighted some adjustments to do before merging.
In particular, Save() can be implemented only using existing functions provided by the StorageEngine. Tests need to be revised, also.

EDIT: I also changed the title of the PR, because it was to generic ;=)

@ostafen ostafen changed the title new funcion and test over it Add Save() method Apr 24, 2022
@ostafen ostafen linked an issue Apr 24, 2022 that may be closed by this pull request
@dbgjerez
Copy link
Contributor Author

Totally agree with you @ostafen, I have modified the PR, I understand better this code thanks of you.

@dbgjerez dbgjerez requested a review from ostafen April 25, 2022 20:04
db.go Outdated Show resolved Hide resolved
db_test.go Outdated Show resolved Hide resolved
Copy link
Owner

@ostafen ostafen left a comment

Choose a reason for hiding this comment

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

Hi, @dbgjerez, sorry for the delay. I requested you some minor changes

@dbgjerez
Copy link
Contributor Author

Sure bro, I have done both changes. I think that really is better, like you said.

@dbgjerez dbgjerez requested a review from ostafen April 26, 2022 17:44
db_test.go Outdated Show resolved Hide resolved
db_test.go Outdated Show resolved Hide resolved
Copy link
Owner

@ostafen ostafen left a comment

Choose a reason for hiding this comment

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

The implementation of the Save() functions looks good now.
Checks inside TestSaveDocument() needs a minor revision because actually, by only testing the size of the collection with Count() we can only be sure that some document is being saved, but we cannot be sure if the document is consistent.

Also, since we merged the tests, delete the TestSaveNewDocument() function.
I think also that code will be easier to follow if we use string literals directly instead of defining these variables:

collection := "myCollection"
key := "hello"
updatedValue := "clover-updated!"

Thanks for your patience!

@dbgjerez
Copy link
Contributor Author

Ok, I have done the change and upload it. Thanks!

@dbgjerez dbgjerez requested a review from ostafen April 26, 2022 21:48
@ostafen ostafen merged commit 133e2c7 into ostafen:main Apr 26, 2022
@ostafen
Copy link
Owner

ostafen commented Apr 26, 2022

Thank you for this!

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.

SaveOrUpdate
2 participants