Skip to content

Commit

Permalink
chore: make the workspace compile when no DB is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
poliorcetics committed Apr 23, 2024
1 parent 4feba43 commit cd344a9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
20 changes: 2 additions & 18 deletions atmosphere-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,39 +21,31 @@
//! - Code reusability across API layers using generics.
//! - Compile-time introspection for type-safe schema generation.

#[cfg(any(feature = "mysql", feature = "postgres", feature = "sqlite"))]
#![cfg(any(feature = "postgres", feature = "mysql", feature = "sqlite"))]

/// Facilitates binding entities to queries, ensuring type safety and ease of use in query construction.
pub mod bind;
#[cfg(any(feature = "mysql", feature = "postgres", feature = "sqlite"))]
/// Defines high-level database error types, offering a structured approach to error handling.
pub mod error;
#[cfg(any(feature = "mysql", feature = "postgres", feature = "sqlite"))]
/// Implements a hook system, allowing custom logic to be executed at different stages of database
/// interactions.
#[cfg(any(feature = "mysql", feature = "postgres", feature = "sqlite"))]
pub mod hooks;
#[cfg(any(feature = "mysql", feature = "postgres", feature = "sqlite"))]
/// Offers an abstraction layer for building and executing SQL queries, simplifying complex query
/// logic.
pub mod query;
#[cfg(any(feature = "mysql", feature = "postgres", feature = "sqlite"))]
/// Models SQL relationships, providing tools to define and manipulate relationships between
/// database entities.
pub mod rel;
#[cfg(any(feature = "mysql", feature = "postgres", feature = "sqlite"))]
/// Manages the runtime environment for database operations, encompassing execution contexts and
/// configurations.
pub mod runtime;
#[cfg(any(feature = "mysql", feature = "postgres", feature = "sqlite"))]
/// Contains compile-time generated SQL schema traits, enabling a declarative approach to schema
/// definition.
pub mod schema;
#[cfg(any(feature = "mysql", feature = "postgres", feature = "sqlite"))]
/// Provides utilities for automated testing of SQL interactions, ensuring reliability and
/// correctness of database operations.
pub mod testing;

#[cfg(any(feature = "mysql", feature = "postgres", feature = "sqlite"))]
pub use driver::{Driver, Pool};

/// Driver System
Expand Down Expand Up @@ -95,18 +87,10 @@ pub mod driver {
#[cfg(all(feature = "sqlite", not(any(feature = "postgres", feature = "mysql"))))]
/// Atmosphere Database Pool
pub type Pool = sqlx::SqlitePool;

#[cfg(not(any(feature = "postgres", feature = "mysql", feature = "sqlite")))]
compile_error!(
"you must chose a atmosphere database driver (available: postgres, mysql, sqlite)"
);
}

#[cfg(any(feature = "mysql", feature = "postgres", feature = "sqlite"))]
pub use bind::*;
#[cfg(any(feature = "mysql", feature = "postgres", feature = "sqlite"))]
pub use error::*;
#[cfg(any(feature = "mysql", feature = "postgres", feature = "sqlite"))]
pub use schema::*;

#[doc(hidden)]
Expand Down
2 changes: 2 additions & 0 deletions atmosphere-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
//! and align with the framework's conventions, making them a powerful tool in the application
//! development process.

#![cfg(any(feature = "postgres", feature = "mysql", feature = "sqlite"))]

use proc_macro::TokenStream;
use quote::{quote, ToTokens};
use syn::{parse_macro_input, ItemStruct};
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
//! - `postgres`
//! - `sqlite`

#![cfg(any(feature = "postgres", feature = "mysql", feature = "sqlite"))]

pub use atmosphere_core::*;
pub use atmosphere_macros::*;

Expand Down

0 comments on commit cd344a9

Please sign in to comment.