For AI agents: the complete documentation index is available at https://a3s-lab.github.io/ORM/v0.2.0/llms.txt, the full documentation bundle is available at https://a3s-lab.github.io/ORM/v0.2.0/llms-full.txt, and this page is available as Markdown at https://a3s-lab.github.io/ORM/v0.2.0/getting-started/installation.md.
  • 简体中文
  • v0.2.0
  • 安装与 feature

    A3S ORM v0.2.0 要求 Rust 1.85 或更新版本。当前发布通过 Git 标签安装。

    默认 SQLite 运行时

    默认 feature 是 sqlite。下面的配置包含查询构建器、所有方言编译器与 Tokio 安全的 SQLite 执行器。

    [dependencies]
    a3s-orm = { git = "https://github.com/A3S-Lab/ORM", tag = "v0.2.0" }
    tokio = { version = "1", features = ["macros", "rt-multi-thread"] }

    PostgreSQL 运行时

    禁用默认 feature,再启用 postgres:

    [dependencies]
    a3s-orm = { git = "https://github.com/A3S-Lab/ORM", tag = "v0.2.0", default-features = false, features = ["postgres"] }
    tokio = { version = "1", features = ["macros", "rt-multi-thread"] }

    postgres 同时启用 UUID、JSON、Chrono 日期时间、rust_decimal::Decimal 与 SqlArray<T> 支持。

    仅使用查询编译器

    如果应用自己实现 Executor,或者只需要生成 SQL,可以关闭全部默认 feature:

    [dependencies]
    a3s-orm = { git = "https://github.com/A3S-Lab/ORM", tag = "v0.2.0", default-features = false }

    这种模式仍然提供 PostgresDialect、SqliteDialect 和 MysqlDialect,但不包含数据库客户端或 Tokio 依赖。

    Feature 列表

    Feature默认内容
    sqlite是SqliteExecutor、事务、savepoint 与迁移后端
    postgres否PostgresExecutor、连接池、TLS、事务、HA 控制与扩展值
    chrono否日期、时间与时间戳值
    decimal否rust_decimal::Decimal
    json否serde_json::Value
    uuid否uuid::Uuid

    最小工具链检查

    rustc --version
    cargo check

    若使用 PostgreSQL 集成测试,需要提供 A3S_ORM_POSTGRES_URL。生产 TLS 配置还需要 CA PEM 内容,具体见 PostgreSQL 与高可用。