Expand description
§🌍 Atmosphere
A lightweight sql framework for sustainable database reliant systems
§Overview
Atmosphere is a lightweight SQL framework designed for sustainable, database-reliant systems. It leverages Rust’s powerful type and macro systems to derive SQL schemas from your rust struct definitions into an advanced trait system.
Atmosphere provides a suite of modules and types that abstract and facilitate various aspects of database operations, from query construction and execution to error handling and schema management.
§Key Features
- SQL schema derivation from Rust structs.
- Advanced trait system for query generation.
- Automated database code testing with
atmosphere::testing
- ORM-like CRUD traits.
- Code reusability across API layers using generics.
- Compile-time introspection for type-safe schema generation.
§Usage
To use this crate you must activate one of the following features (else the crate is empty):
mysql
postgres
sqlite
Modules§
- bind
- Facilitates binding entities to queries, ensuring type safety and ease of use in query construction. Bind Module for Atmosphere SQL Framework
- driver
- Driver System
- error
- Defines high-level database error types, offering a structured approach to error handling. Error Handling Module for Atmosphere
- hooks
- Implements a hook system, allowing custom logic to be executed at different stages of database interactions. Atmosphere Hook System
- prelude
- A prelude module for bringing commonly used types into scope
- query
- Offers an abstraction layer for building and executing SQL queries, simplifying complex query logic. Provides structures and enums for handling and executing SQL queries, along with error handling.
- rel
- Models SQL relationships, providing tools to define and manipulate relationships between database entities. Provides traits for managing relationships between database entities.
- runtime
- Manages the runtime environment for database operations, encompassing execution contexts and configurations. Runtime Module for Atmosphere SQL Framework
- schema
- Contains compile-time generated SQL schema traits, enabling a declarative approach to schema definition. SQL Schema
- sqlx
- The async SQL toolkit for Rust, built with ❤️ by the LaunchBadge team.
- testing
- Provides utilities for automated testing of SQL interactions, ensuring reliability and correctness of database operations. Provides functions for automated database testing.
Structs§
- Data
Column - Defines a standard data column in the table.
- Foreign
Key - Represents a foreign key column, establishing a relationship to another table.
- Primary
Key - Describes the primary key column of a table.
- Timestamp
Column - Specifies a timestamp column, typically used for tracking creation, update, or deletion times.
Enums§
- Bind
Error - Enumerates errors that can occur during the binding of values to SQL queries.
- Column
- An enum that encapsulates different column types of a table.
- Error
- Errors that can occur within Atmosphere.
Traits§
- Bind
- Trait for binding columns to SQL queries in the context of a specific table.
- Bindable
- Trait for dynamic binding of values.
- Create
- Trait for creating rows in a database.
- Delete
- Trait for deleting rows from a database.
- Entity
- Trait representing an Entity that maps to a database table.
- Read
- Trait for reading rows from a database.
- Table
- SQL Table Definition
- Update
- Update rows in a database.
Type Aliases§
- Driver
- Atmosphere Database Driver
- Pool
- Atmosphere Database Pool
- Result
- A specialized
Result
type for use throughout the Atmosphere framework.
Attribute Macros§
- hooks
- An attribute macro for registering on a table. Must be used after
#[derive(Schema)]
. - table
- An attribute macro that stores metadata about the sql table.
Must be used after
#[derive(Schema)]
.
Derive Macros§
- Schema
- A derive macro that processes structs to automatically generate schema-related code. It reads custom attributes and derives necessary traits and implementations for interacting with the database.