1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
//! # Toql - A friendly and productive ORM
//!
//!
//! [Beginner Guide](https://roy-ganz.github.io/toql), [API documentation](https://docs.rs/toql/0.3/toql/)
//!
//! Toql is an ORM for async databases that features
//! - Translation between Rust structs and database tables.
//! - Can load and modify nested structs.
//! - A unique dead simple query language, suitable for web clients.
//! - Different table aliases from long and readable to tiny and fast.
//! - Prepared statements against SQL injection.
//! - Support for raw SQL for full database power.
//! - Support for role based access.
//! - Highly customizable through user defined parameters, query functions, field handlers, etc.
//! - Compile time safety for queries, fields and path names.
//! - No unsafe Rust code.
//! - Tested on real world scenario.
//!
//! It currently only supports **MySQL**. More are coming, promised :)
//!
//! ## Installation
//! Add this to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! toql = {version = "0.3", features = ["serde"]}
//! toql_mysql_async = "0.3"
//! ```
//!
//! ## Look And Feel
//!
//! Derive your structs:
//! ```rust, ignore
//! #[derive(Toql)]
//! #[toql(auto_key = true)]
//! struct Todo {
//! #[toql(key)]
//! id: u64,
//! what: String,
//!
//! #[toql(join())]
//! user: User
//! }
//! ```
//!
//! And do stuff with them:
//! ```rust, ignore
//! let toql = ...
//! let todo = Todo{ ... };
//!
//! // Insert todo and update its generated id
//! toql.insert_one(&mut todo, paths!(top)).await?;
//!
//! // Compile time checked queries!
//! let q = query!(Todo, "*, user_id eq ?", &todo.user.id);
//!
//! // Typesafe loading
//! let user = toql.load_many(q).await?;
//! ```
//!
//!
//! ## Quick start
//! Toql has a [supporting crate](https://crates.io/crates/toql_rocket) to play well with [Rocket](https://crates.io/crates/rocket). Check out the [CRUD example](https://github.com/roy-ganz/todo_rotomy).
//!
//! ## Contribution
//! Comments, bug fixes and quality improvements are welcome.
//!
//! ## License
//! Toql is distributed under the terms of both the MIT license and the
//! Apache License (Version 2.0).
pub use alias_format;
pub use alias_translator;
pub use error;
pub use from_row;
pub use identity;
pub use key;
pub use key_fields;
pub use keyed;
pub use map_key;
pub use query;
pub use result;
pub use sql;
pub use sql_arg;
pub use sql_expr;
pub use fields;
pub use paths;
pub use log_sql; // Export macro for derives
pub use none_error;
pub use ok_or_fail; // Export macro (TODO: check for removal) // Export macro for macros
pub use backend;
pub use field_handler;
pub use join_handler;
pub use predicate_handler;
pub use query_fields;
pub use query_parser;
pub use query_path;
pub use sql_builder;
pub use table_mapper;
pub use table_mapper_registry;
pub use tree;
//pub use toql_core::update_field;
//pub use toql_core::insert_path;
pub use join;
//pub use toql_core::try_join;
pub use toql_derive as derive;
pub use toql_fields_macro as fields_macro;
pub use toql_paths_macro as paths_macro;
pub use toql_query_macro as query_macro;
pub use toql_role_expr_macro as role_expr_macro;
pub use toql_sql_expr_macro as sql_expr_macro;
pub use cache;
pub use deserialize;
pub use page;
pub use page_counts;
pub use parameter_map;
pub use role_expr;
//pub use toql_core::role_expr_parser;
pub use mock_db;
pub use role_validator;
pub use toql_api; // Export for derives
pub use tracing; // Reexport for derive
pub use serde; // Reexport for derive
pub use log_literal_sql;
pub use row; // For unit tests