pub mod app;
pub mod attachment;
pub mod auth;
pub mod authorization;
pub mod config;
pub mod context;
pub mod controller;
pub mod cookies;
pub mod cors;
pub mod csrf;
pub mod db;
pub mod error;
pub mod files;
pub mod handler;
pub mod html;
pub mod i18n;
pub mod jobs;
pub mod middleware;
pub mod mime;
pub mod model;
pub mod pagination;
mod random;
pub mod request;
pub mod response;
pub mod router;
pub mod serialize;
pub mod session;
pub mod storage;
pub mod telemetry;
pub mod testing;
pub mod time;
pub mod upload;
pub mod view;
pub use app::{App, Service};
pub use config::{Config, Env};
pub use context::{Context, Params, PathParams};
pub use controller::{Action, Resource};
pub use error::{Error, Result};
pub use handler::Handler;
pub use http::{Method, StatusCode, header};
pub use middleware::{Middleware, Next, Pipeline};
pub use model::{Callbacks, Model};
pub use response::{Html, IntoResponse, Json, Response};
pub use router::{Router, ToPath};
pub use serialize::Serializer;
pub use glacier_macros::{
Model, config, controller, controllers, enumeration, jobs, main, model, models, scopes,
serializers, services, static_files, test, tests, views,
};
pub use glacier_macros::paths;
pub use glacier_macros::routes;
pub mod prelude {
pub use crate::db::Save::{self, Invalid, Saved};
pub use crate::db::{Changeset, Date, Decimal, JsonValue, NaiveTimestamp, Timestamp, Uuid};
pub use crate::i18n::{locale, t, t_with};
pub use crate::jobs::{Job, Jobs};
pub use crate::router::ToPath;
pub use crate::serialize::Serializer;
pub use crate::view::{Rendered, Template, html, render};
pub use crate::{
App, Callbacks, Config, Context, Env, Error, Html, IntoResponse, Json, Method, Middleware,
Model, Next, Params, Pipeline, Resource, Response, Result, Router, StatusCode,
};
pub use crate::{json, redirect};
pub use chrono::{Datelike as _, Timelike as _};
}
pub use authorization::skip_authorization;
pub fn authorize(allowed: bool) -> Result<()> {
authorization::mark();
if allowed {
Ok(())
} else {
Err(Error::forbidden())
}
}
#[macro_export]
macro_rules! redirect {
($to:expr $(, $kind:ident : $message:expr)* $(,)?) => {{
$( $crate::request::put_flash(::core::stringify!($kind), $message); )*
let path = {
use $crate::router::ToPath as _;
($to).to_path()
};
$crate::Result::<$crate::Response>::Ok($crate::Response::redirect(&path))
}};
}
#[macro_export]
macro_rules! json {
($value:expr $(, $option:ident = $setting:expr)* $(,)?) => {
$crate::serialize::Render::new(&$value) $( .$option($setting) )* .respond()
};
}
#[macro_export]
macro_rules! migrations {
($($name:ident),* $(,)?) => {
$( mod $name; )*
pub fn all() -> ::std::vec::Vec<$crate::db::migration::Migration> {
::std::vec![$(
$crate::db::migration::Migration::new(::core::stringify!($name), $name::up, $name::down)
),*]
}
};
}
#[cfg(feature = "postgres")]
#[doc(hidden)]
#[macro_export]
macro_rules! __with_postgres {
($($code:tt)*) => { $($code)* };
}
#[cfg(not(feature = "postgres"))]
#[doc(hidden)]
#[macro_export]
macro_rules! __with_postgres {
($($code:tt)*) => {};
}
#[cfg(feature = "sqlite")]
#[doc(hidden)]
#[macro_export]
macro_rules! __with_sqlite {
($($code:tt)*) => { $($code)* };
}
#[cfg(not(feature = "sqlite"))]
#[doc(hidden)]
#[macro_export]
macro_rules! __with_sqlite {
($($code:tt)*) => {};
}
pub use sqlx;
pub use chrono;
#[doc(hidden)]
pub mod __private {
pub use serde;
pub use serde_json;
pub use tokio;
}