[][src]Module butane_core::db

Types, traits, and methods for interacting with a database.

The different ways of referring to a database handle may present some initial confusion.

  • ConnectionMethods is a trait containing the methods available on a database connection or a transaction. Most methods on a DataObject or a Query require an implementation of ConnectionMethods.
  • BackendConnection is a trait representing a direct connection to a database backend. It is a superset of ConnectionMethods and also includes the ability to create a transaction.
  • Transaction is a struct representing a database transaction. It implements ConnectionMethods.
  • Connection is a convience struct containing a boxed BackendConnection. It cannot do anything other than what a BackendConnection can do, but allows using a single concrete type that is not tied to a particular database backend. It is returned by the connect method.

Structs

Column

Represents a database column. Most users do not need to use this directly.

Connection

Database connection. May be a connection to any type of database as it is a boxed abstraction over a specific connection.

ConnectionSpec

Connection specification. Contains the name of a database backend and the backend-specific connection string. See connect to make a Connection from a ConnectionSpec.

Row

Represents a database row. Most users do not need to use this directly.

Transaction

Database transaction.

Traits

Backend

Database backend. A boxed implementation can be returned by name via get_backend.

BackendConnection

Database connection.

ConnectionMethods

Methods available on a database connection. Most users do not need to call these methods directly and will instead use methods on DataObject or the query! macro. This trait is implemented by both database connections and transactions.

Functions

connect

Connect to a database. For non-boxed connections, see individual Backend implementations.

get_backend

Find a backend by name.

Type Definitions

QueryResult
RawQueryResult