#toql #query #integration #mysql #structs #id

toql_mysql

Library with mysql integration for toql

3 releases

0.1.2 May 20, 2019
0.1.1 May 17, 2019
0.1.0 May 15, 2019

#8 in #toql

38 downloads per month

MIT/Apache

380KB
9K SLoC

Toql

Description

Toql Transfer object query language is a query language to build SQL statements. It can retrieve filtered, ordered and indiviually selected columns from a database and put the result into your structs.

Toql turns this

id, (+age eq 16; age eq 18), address_street

into

SELECT user.id, user.age, address.street
FROM User user LEFt JOIN Address address ON (user.address_id= address.id)
WHERE user.age = 16 OR user.age = 18
ORDER BY user.age ASC

for all your Toql derived structs.

Resources

There is also a guide and the API documentation.

Installation

Add this to your Cargo.toml:

[dependencies]
toql = { version = "0.1", features = ["mysql"] }

Integration

Toql works well with Rocket: Add this to your Cargo.toml

[dependencies]
toql_rocket = { version = "0.1", features = ["mysql"] }

Right now there is only support for MySql. Add features = ["mysql"] to your Cargo.toml dependencies.

Features

Toql Transfer object query language is a query language to build SQL statements. It can retrieve filtered, ordered and indiviually selected columns from a database and put the result into your structs.

Toql

  • can query, insert, update and delete single and multiple database records.
  • handles dependencies in queries through SQL joins and merges. Cool!
  • is fast, beause the mapper is only created once and than reused.
  • has high level functions for speed and low level functions for edge cases.

Contribution

My near term goal is to support for more web frameworks and databases. However I would like to stabilize the API first. So you are welcome to play around and test it (don't use it in production yet). Comments, bug fixes and quality improvements are welcome. For features please hold on.

Other database projects

Background

I have developed the initial Toql language about 7 years ago for a web project. I have refined it since then and you can see it in action on www.schoolsheet.com, a web service I created in Java for my teaching. The Rust implementation is must faster though ;)

License

Toql is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

Dependencies

~17MB
~352K SLoC