Skip to content

Commit

Permalink
Feature guard macros
Browse files Browse the repository at this point in the history
  • Loading branch information
tyt2y3 committed Sep 30, 2021
1 parent fcd969e commit ca296bc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
11 changes: 8 additions & 3 deletions src/entity/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
pub use crate::{
error::*, ActiveModelBehavior, ActiveModelTrait, ColumnDef, ColumnTrait, ColumnType,
EntityName, EntityTrait, EnumIter, ForeignKeyAction, Iden, IdenStatic, Linked, ModelTrait,
PrimaryKeyToColumn, PrimaryKeyTrait, QueryFilter, QueryResult, Related, RelationDef,
RelationTrait, Select, Value,
};

#[cfg(feature = "macros")]
pub use crate::{
DeriveActiveModel, DeriveActiveModelBehavior, DeriveColumn, DeriveCustomColumn, DeriveEntity,
DeriveEntityModel, DeriveModel, DerivePrimaryKey, DeriveRelation, EntityName, EntityTrait,
EnumIter, ForeignKeyAction, Iden, IdenStatic, Linked, ModelTrait, PrimaryKeyToColumn,
PrimaryKeyTrait, QueryFilter, QueryResult, Related, RelationDef, RelationTrait, Select, Value,
DeriveEntityModel, DeriveModel, DerivePrimaryKey, DeriveRelation,
};

#[cfg(feature = "with-json")]
Expand Down
2 changes: 1 addition & 1 deletion src/executor/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ pub trait TryGetableMany: Sized {
fn try_get_many(res: &QueryResult, pre: &str, cols: &[String]) -> Result<Self, TryGetError>;

/// ```
/// # #[cfg(feature = "mock")]
/// # #[cfg(all(feature = "mock", feature = "macros"))]
/// # use sea_orm::{error::*, tests_cfg::*, MockDatabase, Transaction, DbBackend};
/// #
/// # let db = MockDatabase::new(DbBackend::Postgres)
Expand Down
2 changes: 1 addition & 1 deletion src/executor/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ where
}

/// ```
/// # #[cfg(feature = "mock")]
/// # #[cfg(all(feature = "mock", feature = "macros"))]
/// # use sea_orm::{error::*, tests_cfg::*, MockDatabase, Transaction, DbBackend};
/// #
/// # let db = MockDatabase::new(DbBackend::Postgres)
Expand Down
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,13 @@
//! pub id: i32,
//! pub name: String,
//! }
//!
//!
//! #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
//! pub enum Relation {
//! #[sea_orm(has_many = "super::fruit::Entity")]
//! Fruit,
//! }
//!
//!
//! impl Related<super::fruit::Entity> for Entity {
//! fn to() -> RelationDef {
//! Relation::Fruit.def()
Expand Down Expand Up @@ -433,14 +433,17 @@ pub use executor::*;
pub use query::*;
pub use schema::*;

#[cfg(feature = "macros")]
pub use sea_orm_macros::{
DeriveActiveModel, DeriveActiveModelBehavior, DeriveColumn, DeriveCustomColumn, DeriveEntity,
DeriveEntityModel, DeriveModel, DerivePrimaryKey, DeriveRelation, FromQueryResult,
};

pub use sea_query;
pub use sea_query::Iden;
#[cfg(feature = "macros")]
pub use sea_query::Iden as DeriveIden;

pub use sea_strum;
#[cfg(feature = "macros")]
pub use sea_strum::EnumIter;

0 comments on commit ca296bc

Please sign in to comment.