Module diesel::prelude

source ·
Expand description

Re-exports important traits and types. Meant to be glob imported when using Diesel.



  • 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.
  • Declare a sql function for use in your code.
  • Allow two tables to be referenced in a join query without providing an explicit ON clause.
  • sql_functionwith-deprecated and non-without-deprecated
    A legacy version of define_sql_function!.
  • 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.


  • MysqlConnectionmysql and mysql_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]
  • PgConnectionpostgres and postgres_backend
    The connection string expected by PgConnection::establish should be a PostgreSQL connection string, as documented at
  • Connections for the SQLite backend. Unlike other backends, SQLite supported connection URLs are:



Type Aliases§

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 by sql_query
  • Implements Selectable