Skip to main content

Crate premix_core

Crate premix_core 

Source
Expand description

§Premix ORM Core

Core definitions and traits for the Premix ORM ecosystem. Provides the Model trait, Executor abstraction, and QueryBuilder.

§Architecture

  • Model: The core trait that all database entities must implement.
  • Executor: Abstracts over connection pools and transactions.
  • QueryBuilder: A type-safe SQL query generator with support for:
    • Filtering (eq, ne, gt, lt, in)
    • Pagination (limit, offset)
    • Relations (eager loading)
    • Soft Deletes

This crate is designed to be used with premix-macros for compile-time SQL generation overrides.

Re-exports§

pub use migrator::Migration;
pub use migrator::Migrator;
pub use error::PremixError;
pub use error::PremixResult;
pub use error::map_sqlx_error;
pub use model::FastRow;
pub use model::Model;
pub use model::ModelHooks;
pub use model::ModelValidation;
pub use model::UpdateResult;
pub use model::ValidationError;
pub use query::QueryBuilder;
pub use schema::ModelSchema;
pub use sql_cache::cached_placeholders;
pub use sql_cache::cached_placeholders_from;
pub use dialect::SqlDialect;
pub use executor::Executor;
pub use executor::IntoExecutor;
pub use chrono;
pub use sqlx;
pub use tracing;
pub use uuid;

Modules§

dialect
SQL dialect abstractions for multi-database support.
error
Premix error types and helpers.
executor
Database executor abstraction for connection pools and transactions.
migrator
Database migration engine.
model
Core traits and types for database models.
prelude
The Premix prelude, re-exporting commonly used traits and types.
query
Type-safe SQL query builder.
schema
Database schema introspection and diffing utilities.
sql_cache
Cache helpers for SQL snippets/placeholders.

Macros§

schema_models
Helper macro to collect schema metadata from multiple models.

Structs§

Premix
Main entry point for the Premix ORM helpers.

Functions§

build_placeholders
Helper to build a comma-separated list of placeholders for a given database.