Expand description
Re-exports important traits and types. Meant to be glob imported when using Diesel.
Re-exports§
pub use crate::expression::IntoSql as _;
pub use crate::query_source::SizeRestrictedColumn as _;
Macros§
- allow_
columns_ to_ appear_ in_ same_ group_ by_ clause - Allow two or more columns which are otherwise unrelated to be used together in a group by clause.
- allow_
tables_ to_ appear_ in_ same_ query - Allow two or more tables which are otherwise unrelated to be used together in a query.
- define_
sql_ function - Declare a sql function for use in your code.
- joinable
- Allow two tables to be referenced in a join query without providing an
explicit
ON
clause. - sql_
function with-deprecated
and non-without-deprecated
- A legacy version of
define_sql_function!
. - table
- 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 will find a unit struct named
table
, and a unit struct with the name of each column.
Structs§
- Mysql
Connection mysql
andmysql_backend
- A connection to a MySQL database. Connection URLs should be in the form
mysql://[user[:password]@]host/database_name[?unix_socket=socket-path&ssl_mode=SSL_MODE*&ssl_ca=/etc/ssl/certs/ca-certificates.crt&ssl_cert=/etc/ssl/certs/client-cert.crt&ssl_key=/etc/ssl/certs/client-key.crt]
- PgConnection
postgres
andpostgres_backend
- The connection string expected by
PgConnection::establish
should be a PostgreSQL connection string, as documented at https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNSTRING - Sqlite
Connection sqlite
- Connections for the SQLite backend. Unlike other backends, SQLite supported connection URLs are:
Enums§
- Connection
Error - Errors which can occur during
Connection::establish
Traits§
- Appears
OnTable - Indicates that all elements of an expression are valid given a from clause.
- AsChangeset
- Types which can be passed to
update.set
. - Belonging
ToDsl - Constructs a query that finds record(s) based on directional association with other record(s).
- Bool
Expression Methods - Methods present on boolean expressions
- Boxable
Expression - Helper trait used when boxing expressions.
- Column
- A column on a database table. Types which implement this trait should have
been generated by the
table!
macro. - Combine
Dsl - Extension trait to combine queries using a combinator like
UNION
,INTERSECT
orEXCEPT
with or withoutALL
rule for duplicates - Connection
- A connection to a database
- Decoratable
Target - Interface to add information to conflict targets. Designed to be open for further additions to conflict targets like constraints
- Escape
Expression Methods - Adds the
escape
method toLIKE
andNOT LIKE
. This is used to specify the escape character for the pattern. - Execute
Copy From Dsl postgres_backend
- A custom execute function tailored for
COPY FROM
statements - Expression
- Represents a typed fragment of SQL.
- Expression
Methods - Methods present on all expressions, except tuples
- Grouped
By - The
grouped_by
function groups records by their parent. - Identifiable
- This trait indicates that a struct represents a single row in a database table.
- Insertable
- 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. - IntoSql
- Converts a type to its representation for use in Diesel’s query builder.
- Join
OnDsl - Specify the
ON
clause for a join statement. This will override any implicitON
clause that would come fromjoinable!
- JoinTo
- Indicates that two tables can be joined without an explicit
ON
clause. - Nullable
Expression Methods - Methods present on all expressions
- Optional
Empty Changeset Extension - See the method documentation.
- Optional
Extension - See the method documentation.
- PgAny
Json Expression Methods postgres_backend
- PostgreSQL specific methods present on JSON and JSONB expressions.
- PgArray
Expression Methods postgres_backend
- PostgreSQL specific methods present on array expressions.
- PgBinary
Expression Methods postgres_backend
- PostgreSQL specific methods present on Binary expressions.
- PgExpression
Methods postgres_backend
- PostgreSQL specific methods which are present on all expressions.
- PgJsonb
Expression Methods postgres_backend
- PostgreSQL specific methods present on JSONB expressions.
- PgNet
Expression Methods postgres_backend
- PostgreSQL specific methods present between CIDR/INET expressions
- PgRange
Expression Methods postgres_backend
- PostgreSQL specific methods present on range expressions.
- PgSort
Expression Methods postgres_backend
- PostgreSQL expression methods related to sorting.
- PgText
Expression Methods postgres_backend
- PostgreSQL specific methods present on text expressions.
- PgTimestamp
Expression Methods postgres_backend
- PostgreSQL specific methods present on timestamp expressions.
- Preferred
Bool SqlType - Allow ~type inference on And and Or helper types
- Query
Dsl - Methods used to construct select statements.
- Query
Source - Represents a type which can appear in the
FROM
clause. Apps should not need to concern themselves with this trait. - Queryable
- Trait indicating that a record can be queried from the database.
- Queryable
ByName - Deserializes the result of a query constructed with
sql_query
. - RunQuery
Dsl - Methods used to execute queries.
- Save
Changes Dsl - Sugar for types which implement both
AsChangeset
andIdentifiable
- Selectable
- Trait indicating that a record can be selected and queried from the database.
- Selectable
Expression - Indicates that an expression can be selected from a source.
- Selectable
Helper - This helper trait provides several methods for
constructing a select or returning clause based on a
Selectable
implementation. - Sqlite
Expression Methods sqlite
- Sqlite specific methods which are present on all expressions.
- Table
- A SQL database table. Types which implement this trait should have been
generated by the
table!
macro. - Text
Expression Methods - Methods present on text expressions
Type Aliases§
- Connection
Result - A specialized result type for establishing connections.
- Query
Result - A specialized result type for queries.
Derive Macros§
- AsChangeset
- Implements
AsChangeset
- Associations
- Implement required traits for the associations API
- Identifiable
- Implements
Identifiable
for references of the current type - Insertable
- Implements
Insertable
- Queryable
- Implements
Queryable
to load the result of statically typed queries - Queryable
ByName - Implements
QueryableByName
for untyped sql queries, such as that one generated bysql_query
- Selectable
- Implements
Selectable