tailwag/lib.rs
1/// This contains all of the library code needed for configuring the Postgres DB for a type.
2#[cfg(feature = "orm")]
3pub use tailwag_orm as orm;
4
5/// Various common utilities for coding. Things like string manipulation, common struct patterns, etc.
6#[cfg(feature = "utils")]
7pub use tailwag_utils as utils;
8
9/// Contains library code for creating a REST web service from data types.
10#[cfg(feature = "web_service")]
11pub use tailwag_web_service as web;
12
13#[macro_export]
14macro_rules! derive_magic {
15 ($i:item) => {
16 #[derive(
17 Clone, // Needed to be able to create an editable version from an Arc<Brewery> without affecting the saved data.
18 Debug,
19 Default,
20 serde::Deserialize, // Needed for API de/serialization
21 serde::Serialize, // Needed for API de/serialization
22 // sqlx::FromRow, // Needed for DB connectivity
23 tailwag::macros::GetTableDefinition, // Creates the data structure needed for the ORM to work.
24 tailwag::macros::Insertable,
25 tailwag::macros::Updateable,
26 tailwag::macros::Deleteable,
27 tailwag::macros::Filterable,
28 tailwag::macros::BuildRoutes, // Creates the functions needed for a REST service (full CRUD)
29 tailwag::macros::Id,
30 // tailwag::macros::AsEguiForm, // Renders the object into an editable form for an egui application.
31 tailwag::macros::Display,
32 tailwag::forms::macros::GetForm,
33 )]
34 $i
35 };
36}
37
38use tailwag_macros;
39#[cfg(feature = "macros")]
40pub mod macros {
41 pub use super::derive_magic;
42 pub use crate::utils::inline_macros as inline;
43 pub use inline::*;
44 use tailwag_macros;
45 pub use tailwag_macros::*;
46 pub use tailwag_orm_macros::*;
47}
48
49/// Crate containing GUI application logic and common widgets.
50/// TODO: Rename to `egui` to represent the underlying framework
51/// GUI features not yet released
52// #[cfg(feature = "gui")]
53// pub use tailwag_gui_tools as gui;
54
55/// Various common utilities for coding. Things like string manipulation, common struct patterns, etc.
56#[cfg(feature = "forms")]
57pub use tailwag_forms as forms;
58
59pub mod prelude {
60 pub use super::derive_magic;
61 pub use super::orm::data_manager::traits::WithFilter;
62 pub use super::orm::data_manager::PostgresDataProvider;
63 pub use super::orm::queries::filterable_types::*;
64 pub use super::web::application::http::route::*;
65 pub use super::web::application::WebService;
66 pub use super::web::HttpError;
67 pub use super::web::HttpResult;
68}