Skip to main content

Crate systemprompt_database

Crate systemprompt_database 

Source
Expand description

§systemprompt-database

PostgreSQL infrastructure for systemprompt.io: a thin SQLx-backed pool, generic repository traits, dynamic-query primitives for admin tooling, and lifecycle helpers (schema installation, extension migrations, validation).

§Public API surface

§Feature flags

This crate currently has no Cargo features; everything compiles unconditionally. The [package.metadata.docs.rs] block is in place so --all-features documentation builds remain stable as features are added.

§sqlx allowlist

Static SQL goes through the compile-time-verified sqlx::query! / query_as! / query_scalar! macros. Runtime/dynamic SQL is contained to two paths whose contract is dynamic SQL by design and that are documented in the workspace allowlist (ci/check-sqlx.sh, instructions/prompt/rust.md):

  • src/admin/ — admin CLI surfaces (introspection, restricted query executor) where the SQL is the user input.
  • src/services/postgres/ — the dyn-safe DatabaseProvider implementation, transaction wrapper, type-erased helpers and PostgreSQL schema introspection.

Every other call site uses verified macros.

Re-exports§

pub use extension::DatabaseExtension;
pub use models::ColumnInfo;
pub use models::DatabaseInfo;
pub use models::DatabaseQuery;
pub use models::DatabaseTransaction;
pub use models::FromDatabaseRow;
pub use models::IndexInfo;
pub use models::QueryResult;
pub use models::QueryRow;
pub use models::QuerySelector;
pub use models::TableInfo;
pub use services::BoxFuture;
pub use services::Database;
pub use services::DatabaseCliDisplay;
pub use services::DatabaseExt;
pub use services::DatabaseProvider;
pub use services::DatabaseProviderExt;
pub use services::DbPool;
pub use services::PostgresProvider;
pub use services::SqlExecutor;
pub use services::with_transaction;
pub use services::with_transaction_raw;
pub use services::with_transaction_retry;
pub use error::DatabaseResult;
pub use error::RepositoryError;
pub use lifecycle::AppliedMigration;
pub use lifecycle::MigrationResult;
pub use lifecycle::MigrationService;
pub use lifecycle::MigrationStatus;
pub use lifecycle::ModuleInstaller;
pub use lifecycle::install_extension_schemas;
pub use lifecycle::install_extension_schemas_with_config;
pub use lifecycle::install_module_schemas_from_source;
pub use lifecycle::install_module_seeds_from_path;
pub use lifecycle::install_schema;
pub use lifecycle::install_seed;
pub use lifecycle::validate_column_exists;
pub use lifecycle::validate_database_connection;
pub use lifecycle::validate_table_exists;
pub use repository::CleanupRepository;
pub use repository::CreateServiceInput;
pub use repository::DatabaseInfoRepository;
pub use repository::PgDbPool;
pub use repository::ServiceConfig;
pub use repository::ServiceRepository;
pub use admin::AdminSql;
pub use admin::AdminSqlError;
pub use admin::DEFAULT_READONLY_ROW_LIMIT;
pub use admin::DatabaseAdminService;
pub use admin::IdentifierError;
pub use admin::QueryExecutor;
pub use admin::QueryExecutorError;
pub use admin::SafeIdentifier;

Modules§

admin
Admin-only database surface.
error
Typed error boundary for the database crate.
extension
Extension registration for the database crate’s own schema.
lifecycle
models
Data models exchanged across the database boundary.
repository
Repositories owned by the database crate itself.
services
Service layer: provider abstraction, owned Database handle, transaction helpers, batch execution, and CLI display traits.

Structs§

ArtifactId
ClientId
ContentId
ContextId
ExecutionStepId
FileId
Json
Json for json and jsonb fields
LogId
Pool
An asynchronous pool of SQLx database connections.
Postgres
PostgreSQL database driver.
SessionId
SkillId
TaskId
TokenId
TraceId
Transaction
An in-progress database transaction or savepoint.
UserId

Enums§

DbValue

Traits§

FromDbValue
ToDbValue

Functions§

parse_database_datetime

Type Aliases§

JsonRow
PgPool
An alias for Pool, specialized for Postgres.