Expand description
oxisql-core — core traits and types for the OxiSQL Pure-Rust SQL facade.
This crate defines the public API surface (Connection, Transaction,
Row, Value, OxiSqlError) that every OxiSQL backend must implement.
It has no storage logic of its own; concrete backends live in
oxisql-embedded, oxisql-postgres, etc.
§Extended Type System
Beyond the basic scalar types (Null, Bool, I64, F64, Text,
Blob), Value supports rich database types:
Value::Timestamp— microseconds since Unix epoch (UTC)Value::Date— days since Unix epochValue::Time— microseconds since midnightValue::Uuid— 128-bit UUID stored asu128Value::Json— JSON/JSONB stored as aStringValue::Decimal— exact decimal as a string representationValue::Array— ordered collection ofValues (Postgres arrays)
§Type-Safe Extraction
Use Row::try_get with the FromValue trait for ergonomic,
type-safe value extraction:
let row = Row::new(
vec!["id".into(), "name".into()],
vec![Value::I64(42), Value::Text("Alice".into())],
);
let id: i64 = row.try_get("id").unwrap();
let name: String = row.try_get("name").unwrap();Re-exports§
pub use middleware::ConnectionMetrics;pub use middleware::LoggingConnection;pub use middleware::MetricsConnection;pub use middleware::MetricsSnapshot;pub use middleware::RetryConnection;pub use middleware::RetryPolicy;pub use middleware::RetryPredicate;pub use params::bind_named_params;pub use params::rewrite_named_params;pub use query::BuiltQuery;pub use query::DeleteBuilder;pub use query::InsertBuilder;pub use query::SelectBuilder;pub use query::SortDirection;pub use query::UpdateBuilder;pub use registry::SqlType;pub use registry::TypeRegistry;pub use schema::ColumnInfo;pub use schema::ForeignKeyInfo;pub use schema::IndexInfo;pub use schema::TableInfo;pub use schema::TableType;
Modules§
- middleware
- Middleware wrappers for
Connection— logging and metrics. - params
- Named-parameter rewriting for OxiSQL.
- query
- Fluent query builder for constructing SQL strings with positional parameters.
- registry
TypeRegistry— bidirectional mapping between SQL type-name strings andSqlTypedescriptors, together with defaultValueconstruction.- schema
- Types returned by
Connectionschema-inspection methods.
Structs§
- Cursor
- An incremental cursor for traversing a materialised result set.
- Migration
Info - Metadata describing a single migration version.
- Row
- A single row returned from a query, with named columns.
- RowSet
- A collection of
Rows with schema metadata. - SqlWarning
- A SQL warning returned by the database server after a statement.
Enums§
- Array
Element Type - The nominal SQL element type of a
Value::TypedArray. - Borrowed
Value - A borrowed, zero-allocation view of a SQL value.
- Migration
Status - The execution status of a single migration version.
- OxiSql
Error - Errors that can occur during OxiSQL operations.
- SqlWarning
Level - Severity level of a SQL warning.
- Value
- A single SQL value returned from or passed to a query.
Traits§
- Connection
- An async database connection.
- Connection
Pool - A pool of database connections.
- From
Value - Extract a typed value from a
Valueenum variant. - Migrator
- An async trait for managing database schema migrations.
- Prepared
Statement - A server-side prepared statement.
- ToSql
Value - A value that can be used as a positional SQL parameter (
$1,$2, …). - Transaction
- A database transaction obtained via
Connection::transaction.
Functions§
- parse_
warning_ level - Parse a MySQL warning level string into a
SqlWarningLevel.