Open egarim opened 7 years ago
@egarim : I am not a contributor to this repo. But I have a similar use case to yours. You should take a look at odata-v4-pg and odata-v4-sql packages. It is used to parse odata syntax and generate the sql queries.. You can very well use that as a template to derive your custom logic. FYI - All the magic happens in visitor.ts
Hi @egarim,
odata-v4-server is a platform independent generic OData server and you can implement any business logic in the controllers. Connectors are specific OData query compilers, which are transforming the OData query AST to the specific platform query. As @silasjohn correctly aligned you in the right direction, each connector magic is in the connector's visitor.ts
file. It is walking the AST tree's nodes and builds the final SQL or mongodb query during the process. You can use an existing connector (as you can see in the pg, mysql, and mssql connectors extending the original odata-v4-sql visitor) or create a new one from scratch. So finally, do the platform specific or custom logic in your ODataController implementation. Connectors are just helpers to use the OData query AST easier.
thanks I was just retaking this projects this is a great input
On Tue, Aug 22, 2017 at 11:12 AM, Viktor Lázár notifications@github.com wrote:
Hi @egarim https://github.com/egarim, odata-v4-server is a platform independent generic OData server and you can implement any business logic in the controllers. Connectors are specific OData query compilers, which are transforming the OData query AST to the specific platform query. As @silasjohn https://github.com/silasjohn correctly aligned you in the right direction, each connector magic is in the connector's visitor.ts file. It is walking the AST tree's nodes and builds the final SQL or mongodb query during the process. You can use an existing connector (as you can see in the pg, mysql, and mssql connectors extending the original odata-v4-sql visitor) or create a new one from scratch. So finally, do the platform specific or custom logic in your ODataController implementation. Connectors are just helpers to use the OData query AST easier.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jaystack/odata-v4-server/issues/13#issuecomment-323952487, or mute the thread https://github.com/notifications/unsubscribe-auth/ACu2pJK7DhgYoYqwgBCvL7hQiFKD2rUWks5sao1ZgaJpZM4NmOM7 .
-- Regards Jose Manuel Ojeda
Our sites Xamarin Android Apps http://www.xamarin-android-apps.com Xamarin iOS Apps http://www.xamarin-ios-apps.com Xamarin Forms Apps http://www.xamarin-forms-apps.com
Skype:Jose.Manuel.Ojeda GoogleTalk:joche.ojeda@bitframeworks.com Cellphone: 503 79235612 QQ:2492739188
Hi i have been able to setup the odata server for postgres using the following repository
https://github.com/jaystack/odata-v4-server-pgsql-example
the repository contains the source with all needed references to connect to postgres serve a model, now I wonder, how can you start from the scratch with just the odata-v4-server and add the correct connectors to connect to an specific database.
can you provide an example to achieve my goal? to turn the generic version of the server and the turn it into a postgres , mongo or mysql odata server