-
Notifications
You must be signed in to change notification settings - Fork 0
Activemodel7 couchbase ruby client #2
base: master
Are you sure you want to change the base?
Conversation
CedricCouton
commented
Jun 23, 2022
| CouchbaseOrm.logger.debug "Data - Get #{id}" | ||
| !bucket.get(id, quiet: true).nil? | ||
| CouchbaseOrm.logger.debug "Data - Exists? #{id}" | ||
| collection.exists(id).exists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a exists? method in collection
| alias_method :has_key?, :exists? | ||
| end | ||
|
|
||
| class MismatchTypeError < RuntimeError; end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
surement à supprimer
| def touch(**options) | ||
| CouchbaseOrm.logger.debug "Data - Touch #{@__metadata__.key}" | ||
| res = self.class.bucket.touch(@__metadata__.key, async: false, **options) | ||
| res = self.class.collection.touch(@__metadata__.key, async: false, **options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace all **options by encapsulating them with Options
| else | ||
| false | ||
| end | ||
| records = quiet ? collection.get_multi(ids) : collection.get_multi!(ids) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should pass option to get_multi
| nil | ||
| end | ||
|
|
||
| def get_multi!(*ids, **options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should add a test where first id is valid but not second
|
|
||
| # Clean up record if the id doesn't exist | ||
| self.bucket.delete(key, quiet: true) | ||
| self.collection.remove(key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't destruct db on a finder
test migration to actionmodel7 + rails7
GitHub actions
0fd05cc to
922dbb8
Compare