Open intervalia opened 4 years ago
@intervalia Thanks for posting! We'll take a look as soon as possible.
In the mean time, there are a few ways you can help speed things along:
Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly.
For help with questions about Sails, click here.
Same problem. If you figure out the solution, please share it!
Hmm, @intervalia, I don't think that Waterline supports calling those functions. If this functionality is desirable to many users, though, we'll consider it for the future!
I think it is important to be able to call specific SQL functions through the ORM. It would be nice to specify a SET function and a GET function for a specific field. In this case we are storing a GUID as a 16-byte binary value and not as a 36-byte string. This is a huge savings when we have millions of entries that all have a GUID.
@intervalia, that makes a lot of sense to me. We'll be sure to keep this in mind when considering new features.
I guess the other way to do this is to provide a BIN_GUID
format/type that would convert to and from the binary(16)
and char(36)
Just an FYI: I am no on the project that had this problem and have no way to validate if it is working.
I think you can accomplish this using sendNativeQuery()
.
Node version: 10.15.0 sails: ^1.2.3, sails-hook-orm: ^2.1.1, sails-hook-sockets: ^2.0.0, sails-mysql: ^1.0.1
I have an existing mySQL database with a table that stores a UUID as
binary(16)
This database also has a function (UUID_TO_BIN
) to convert a UUID from astring
tobinary(16)
and another function (BIN_TO_UUID
) to convert frombinary(16)
to astring
.But I can not find anywhere that explains how I can call these functions using a sails model.
Here is my model:
What can I do to get the
uuid
value to be processed by my internal functionBIN_TO_UUID
?