Expand description
Re-exports important traits and types. Meant to be glob imported when using Diesel.
Re-exports
pub use crate::associations::Identifiable;
pub use crate::deserialize::Queryable;
pub use crate::deserialize::QueryableByName;
pub use crate::expression::Selectable;
pub use crate::insertable::Insertable;
pub use crate::query_builder::AsChangeset;
Macros
- Allow two or more columns which are otherwise unrelated to be used together in a group by clause.
- Allow two or more tables which are otherwise unrelated to be used together in a query.
- Allow two tables to be referenced in a join query without providing an explicit
ON
clause. - Declare a sql function for use in your code.
- Specifies that a table exists, and what columns it has. This will create a new public module, with the same name, as the name of the table. In this module, you’ll find a unit struct named
table
, and a unit struct with the names of each of the columns.
Structs
- MysqlConnection
mysql
andmysql_backend
A connection to a MySQL database. Connection URLs should be in the formmysql://[user[:password]@]host/database_name
- PgConnection
postgres
andpostgres_backend
The connection string expected byPgConnection::establish
should be a PostgreSQL connection string, as documented at https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNSTRING - SqliteConnection
sqlite
Connections for the SQLite backend. Unlike other backends, SQLite supported connection URLs are:
Enums
- Errors which can occur during
Connection::establish
Traits
- Indicates that all elements of an expression are valid given a from clause.
- Types which can be passed to
update.set
. - Constructs a query that finds record(s) based on directional association with other record(s).
- Methods present on boolean expressions
- Helper trait used when boxing expressions.
- A column on a database table. Types which implement this trait should have been generated by the
table!
macro. - Extension trait to combine queries using a combinator like
UNION
,INTERSECT
orEXPECT
with or withoutALL
rule for duplicates - A connection to a database
- Interface to add information to conflict targets. Designed to be open for further additions to conflict targets like constraints
- Adds the
escape
method toLIKE
andNOT LIKE
. This is used to specify the escape character for the pattern. - Represents a typed fragment of SQL.
- Methods present on all expressions, except tuples
- The
grouped_by
function groups records by their parent. - This trait indicates that a struct represents a single row in a database table.
- Represents that a structure can be used to insert a new row into the database. This is automatically implemented for
&[T]
and&Vec<T>
for inserting more than one record. - Converts a type to its representation for use in Diesel’s query builder.
- Specify the
ON
clause for a join statement. This will override any implicitON
clause that would come fromjoinable!
- Indicates that two tables can be joined without an explicit
ON
clause. - Methods present on all expressions
- See the method documentation.
- PgAnyJsonExpressionMethods
postgres_backend
PostgreSQL specific methods present on JSON and JSONB expressions. - PgArrayExpressionMethods
postgres_backend
PostgreSQL specific methods present on array expressions. - PgBinaryExpressionMethods
postgres_backend
PostgreSQL specific methods present on Binary expressions. - PgExpressionMethods
postgres_backend
PostgreSQL specific methods which are present on all expressions. - PgJsonbExpressionMethods
postgres_backend
PostgreSQL specific methods present on JSONB expressions. - PgNetExpressionMethods
postgres_backend
PostgreSQL specific methods present between CIDR/INET expressions - PgRangeExpressionMethods
postgres_backend
PostgreSQL specific methods present on range expressions. - PgSortExpressionMethods
postgres_backend
PostgreSQL expression methods related to sorting. - PgTextExpressionMethods
postgres_backend
PostgreSQL specific methods present on text expressions. - PgTimestampExpressionMethods
postgres_backend
PostgreSQL specific methods present on timestamp expressions. - Methods used to construct select statements.
- Represents a type which can appear in the
FROM
clause. Apps should not need to concern themselves with this trait. - Trait indicating that a record can be queried from the database.
- Deserializes the result of a query constructed with
sql_query
. - Methods used to execute queries.
- Sugar for types which implement both
AsChangeset
andIdentifiable
- Trait indicating that a record can be selected and queried from the database.
- Indicates that an expression can be selected from a source.
- This helper trait provides several methods for constructing a select or returning clause based on a
Selectable
implementation. - SqliteExpressionMethods
sqlite
Sqlite specific methods which are present on all expressions. - A SQL database table. Types which implement this trait should have been generated by the
table!
macro. - Methods present on text expressions
Type Definitions
- A specialized result type for establishing connections.
- A specialized result type for queries.
Derive Macros
- Implements
AsChangeset
- Implement required traits for the associations API
- Implements
Identifiable
for references of the current type - Implements
Insertable
- Implements
Queryable
to load the result of statically typed queries - Implements
QueryableByName
for untyped sql queries, such as that one generated bysql_query
- Implements
Selectable