porm 0.1.0

SQL first ORM for PostgreSQL
Documentation
//! ORM for PostgreSQL based on SQL migration scripts.
//!
//! # Quickstart
//! The first step is adding [tokio-postgres](https://crates.io/crates/tokio-postgres) to your
//! project and connect to PostgreSQL. Then create a directory for migration scripts within your
//! project and create `0.sql` in that directory for initial version of database schema.
//!
//! ## Create build scripts
//! Add [porm-parser](https://crates.io/crates/porm-parser) as a build dependency and create
//! `build.rs` with the following content:
//!
//! ```ignore
//! use porm_parser::parse_for_build_script;
//!
//! fn main() {
//!     parse_for_build_script("PATH_TO_MIGRATION_SCRIPTS", |p| {
//!         p.file_stem()
//!             .unwrap()
//!             .to_str()
//!             .ok_or("file stem is not UTF-8")?
//!             .parse::<u32>()
//!             .map_err(|e| e.into())
//!     })
//!     .unwrap();
//! }
//! ```
//!
//! Replace `PATH_TO_MIGRATION_SCRIPTS` with path to the directory to have created.
//!
//! ## Include generated models
//! Add [porm](https://crates.io/crates/porm) as a dependency and create a module with the following
//! content:
//!
//! ```ignore
//! #![allow(unused)]
//!
//! porm::include_models!();
//! ```
//!
//! Then you can access the generated model via this module.
//!
//! ## Apply migration scripts
//! Use [crate::migration::migrate()] to apply migration scripts. Pass `MIGRATIONS` from the above
//! module as a last arguments.
pub mod migration;

/// Include models that was generated by [porm-parser](https://crates.io/crates/porm-parser).
///
/// This will pull generated models into the calling module. This also pull migration list to be
/// used with [migrate](crate::migration::migrate()).
///
/// Environment variable `PORM_GENERATED_FILE` must be set to the generated file.
pub use porm_macros::include_models;