Skip to main content

Crate rust_rel8

Crate rust_rel8 

Source
Expand description

Welcome to Rust Rel8

This is a port of Haskell’s excellent Rel8 library which provides a type safe and expressive interface for constructing SQL queries.

Unlike other ORMs and query builders, this library does not provide a builder pattern on top of the AST for a SQL query, but instead allows you to write queries as if the tables themselves were just arrays in rust.

Re-exports§

pub use helper_utilities::ShortenLifetime;
pub use table_modes::*;

Modules§

helper_tables
A set of helper tables that are equivalent to tuples.
helper_utilities
is_nullable
Helper trait that is used to mark if a type could be NULL on the SQL side.
table_modes
The modes a table can be in

Structs§

A
A struct allowing manipulation of an aggregation
ErasedExpr
A publicly exposed opaque type that is used by Table::visit and Table::visit_mut. Its purpose is to allow you to store Exprs in your types which implement the Table trait.
Expr
A type representing an expression in the query, can be passed around on the rust side to wire things up
Insert
Construct an insert statement, the result of the query rows will be inserted into into.
ListTable
A table representing an array aggregation.
MaybeTable
A table which contains a tag indicating whether a query returned rows. Use Query::optional to construct this.
NullTable
A table wrapping another. This table’s rows are assumed null if any of the non-nullable columns in T are null.
Over
A struct representing an OVER used by a window function.
Q
An opaque value you can use to compose together queries.
Query
A value representing a sql select statement which produces rows of type T.
TableSchema
A table’s name and column names.
TableUsingMapper
A wrapper which implements Table for any type implementing MapTable in ExprMode.
W
A struct allowing insertion of window functions
WithLtMarker
Private type used to restrict calls of ForLifetimeTable::with_lt to the library.

Enums§

VisitTableMode
How to visit the columns in a table

Traits§

ForLifetimeTable
A helper trait that allows us to talk about a Table with different lifetimes. Conceptually it is a type level function of lt -> T where T: Table<'lt>.
LitTable
Trait for tables containing values which we can turn into literals
MapTable
This trait allows us to change the mode of a table by mapping all the fields with ModeMapper, ModeMapperRef, or ModeMapperMut.
ModeMapper
This trait allows us to write a mapping function between two column modes.
ModeMapperMut
This trait allows us to write a mapping function between two column modes.
ModeMapperRef
This trait allows us to write a mapping function between two column modes.
SqlxValueIfEnabled
Proxy trait for sqlx::Decode that we can switch off if not enabled
Table
A trait that represents a database result row.
TableHKT
A trait abstracting the mode of a user defined table, which allows us to talk about the same table in two different modes.
TableLoaderManySqlx
Trait allowing loading of many Tables when using sqlx.
TableLoaderSqlx
Trait allowing loading of Tables when using sqlx.
TableMode
Table modes, this trait is used to switch the types of a rust structs fields.
Value
This trait represents values we know to encode and decode from their database type.

Functions§

query
Open a context allowing you to manipulate a query.

Derive Macros§

TableStruct
Derive the necessary traits for Table structs