Concept
Toql is a ORM that aims to boost your developer comfort and speed when working with databases.
To use it you must derive Toql
for all structs that represent a table in your database:
- A field in those structs represents either a columns, an SQL expression or a relationship to one or many tables.
- The field also determines the field name or in case of a relationship the path name in the Toql query
A struct may map only some columns of a table and also multiple structs may refer to the same table. Structs are rather 'views' to a table.
A derived struct can then be inserted, updated, deleted and loaded from your database. To do that you must call the Toql API functions with a query string or a list of field names or paths.
Here the typical flow in a web environment:
- A web client sends a Toql query to the REST Server.
- The server uses Toql to parse the query and to create SQL statements.
- Toql sends the SQL to the database
- then deserializes the resulting rows into Rust structs.
- The server sends these structs to the client.
Quickstart
There is full featured REST server based on Rocket, Toql and MySQL. It can be used as a playground or starting point for own projects.