[][src]Crate toql_derive

The Toql Derive creates all the boilerplate functions to make the ✨ happen. Using the derive is the easiest way to deal with your structs and is therefore recommended. However beware that the generated code size can become large as it's about ~9K lines of code for a small struct. You may disable some functionality.

For a derived struct the following is generated:

  • Trait Mapped to map struct to SqlMapper.
  • Methods for all fields to support building a Query.
  • Methods to load, insert, delete and update a struct. Requires database feature.


use toql::derive::Toql;
struct User {
  #[toql(delup_key)] // Use this field as key for delete and update 
  id : u64,
  username : Option<String>

Check out the guide for list of available attributes.

Derive Macros


Derive to add Toql functionality to your struct.