DatabaseQueryable

public protocol DatabaseQueryable

Capable of asynchronously executing a generic Query, passing zero or more output to a supplied handler.

  • Associated query type.

    Declaration

    Swift

    associatedtype Query
  • Associated query output type.

    Declaration

    Swift

    associatedtype Output
  • Asynchronously executes a query passing zero or more output to the supplied handler.

    let rows = try conn.query(...) { output in
        print(output)
    }.wait()
    

    Declaration

    Swift

    func query(_ query: Query, _ handler: @escaping (Output) throws -> ()) -> Future<Void>

    Parameters

    query

    Query to execute.

    handler

    Output handler.

    Return Value

    A Future that signals completion.

  • query(_:) Extension method

    Executes the supplied Query, aggregating the results into an array.

    let rows = try conn.query(...).wait()
    

    Declaration

    Swift

    public func query(_ query: Query) -> Future<[Output]>

    Parameters

    query

    Query to execute.

    Return Value

    A Future containing array of output.