You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What we want is some kind of system, which allows a more or less dialect-independent way of converting data types between their javascript at DB representations. This system should also be extendable by the user
For this feature we'd probably need a bit of api discussion first - feel free to provide a suggestion, or more details into the use case you'd like this to support
@florian-rossiaud we would agree with that, hence the proposal for an UP/DOWN system that would take all the current escaping/parsing logic and place it with the data types.
In your example both ST_GeomFromGeoJSON and ST_AsGeoJSON are DB methods right?
In my mind, one method takes a JS representation and converts in to DB representation ready for insert, the other takes a DB representation and converts in to JS. An example for DATE would be
We can already do that with get and set method in the model. But we can do a up and down method for the DataType and a get and set method for have both functionality.
I know something like that is already possible, but my idea was to move the code up one level of abstraction so to speak - so that it is applied to all field instances of that type:
Activity
floross commentedon Mar 6, 2015
Hi,
Do you know for when this feature will be implement ? May I can help ?
Because I would like to use
ST_AsGeoJSONandST_GeomFromGeoJSONfrom postgis but in this state I can't.mickhansen commentedon Mar 6, 2015
@florian-rossiaud No estimate. When we get to it is all we can say i'm afraid.
janmeier commentedon Mar 6, 2015
... But pull requests are always welcome :-).
For this feature we'd probably need a bit of api discussion first - feel free to provide a suggestion, or more details into the use case you'd like this to support
floross commentedon Mar 6, 2015
I think the DataType should know how to escape his value. We could have a function inside DataType
escapewho espace the value on the query.For now escape is like that :
So for each DataType in each dialect you return an formatted string in function of what you need.
You could use a things like this :
All your logic will be in your dataType.
mickhansen commentedon Mar 6, 2015
@florian-rossiaud we would agree with that, hence the proposal for an UP/DOWN system that would take all the current escaping/parsing logic and place it with the data types.
janmeier commentedon Mar 7, 2015
In your example both
ST_GeomFromGeoJSONandST_AsGeoJSONare DB methods right?In my mind, one method takes a JS representation and converts in to DB representation ready for insert, the other takes a DB representation and converts in to JS. An example for DATE would be
floross commentedon Mar 9, 2015
We can already do that with
getandsetmethod in the model. But we can do aupanddownmethod for the DataType and agetandsetmethod for have both functionality.janmeier commentedon Mar 9, 2015
I know something like that is already possible, but my idea was to move the code up one level of abstraction so to speak - so that it is applied to all field instances of that type:
floross commentedon Mar 9, 2015
True that.
I don't have so much time to implement this pr but if I found some time in the next week ill give a try (to implement up / down and set / get)