forked from balderdashy/waterline
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add uuid type with primary key coercion (#32)
* Coerce uuid primary keys Adds a check to normalize.expandPK on uuid type primary keys, and coerces them to a UUID-patterned string. Adds normalize.expandPK to deferred so that chained `where` calls also coerce the criteria. * Add test for uuid primary key coercion Adds a test in the finder query test for checking that UUIDs get defered. The PK coercion behavior doesn't seem to be tested at this level, but this seems like the most appropriate place. * Throw TypeError when given non-uuid Changes primary key type coercion on UUIDs to throw a TypeError when attempting to coerce a value that is not a UUID. * Add a comment around coercing uuids * Simplify test for primary key normalization in deferred queries This removes the uuid-specific test for testing normalization of primary keys in deferred queries. This behavior can more simply be checked with the pre-existing test setup by simply checking that string representations of integers are properly coerced to their integer form. * Only coerce uuid primary keys when schema is uuid Change normalize.expandPK to only coerce the uuid when the underlying schema is reported as UUID as well. * Address PR feedback Fix typo and pull out UUID regex.
- Loading branch information
Showing
4 changed files
with
158 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters