Database

public protocol Database

Types conforming to this protocol can be used as a database for connections and connection pools.

This protocol is the basis for ...Supporting protocols that further extend it, such as KeyedCacheSupporting.

  • This database’s connection type. Protocols that extend Database should be implemented using static methods on this type that supplied an instance of Connection.

    Declaration

    Swift

    associatedtype Connection : DatabaseConnection
  • Creates a new DatabaseConnection that will perform async work on the supplied Worker.

    let conn = try database.newConnection(on: ...).wait()
    

    Declaration

    Swift

    func newConnection(on worker: Worker) -> Future<Connection>

    Parameters

    worker

    Worker to perform async work on.