diff --git a/docs/Classes.html b/docs/Classes.html index 1985684..331e747 100644 --- a/docs/Classes.html +++ b/docs/Classes.html @@ -88,12 +88,39 @@ + + + + + + + + + @@ -255,7 +282,7 @@

Declaration

diff --git a/docs/Classes/Database.html b/docs/Classes/Database.html index e652b54..90e8997 100644 --- a/docs/Classes/Database.html +++ b/docs/Classes/Database.html @@ -89,12 +89,39 @@ + + + + + + + + + @@ -134,9 +161,9 @@

Database

  • - - - default + + + DatabaseTask
    @@ -144,14 +171,14 @@

    Database

    -

    Global default Database for the application

    +

    Definition of a DatabaseTask completion handler which accepts an optional Connection and optional Error

    Declaration

    Swift

    -
    public static var `default`: Database?
    +
    public typealias DatabaseTask = (Connection?, QueryError?) -> ()
    @@ -161,9 +188,9 @@

    Declaration

  • - - - tableInfo + + + default
    @@ -171,14 +198,14 @@

    Declaration

    -

    Instance of TableInfo containing cached tables

    +

    Global default Database for the application

    Declaration

    Swift

    -
    public static var tableInfo = TableInfo()
    +
    public static var `default`: Database?
    @@ -188,9 +215,9 @@

    Declaration

  • - - - init(single:) + + + tableInfo
    @@ -198,14 +225,14 @@

    Declaration

    -

    Constructor for a single connection which becomes a connection pool

    +

    Instance of TableInfo containing cached tables

    Declaration

    Swift

    -
    public convenience init(single connection: Connection)
    +
    public static var tableInfo = TableInfo()
    @@ -215,9 +242,9 @@

    Declaration

  • - - - init(_:) + + + init(single:)
    @@ -225,14 +252,28 @@

    Declaration

    -

    Default constructor for a connection pool

    +

    Create a Database instance which uses a single connection to perform each operation. The connection will remain open for the lifetime of the Database. +It is safe for you to issue concurrent operations on the database: the ORM will ensure those operations are executed sequentially. +This connection strategy provides lower latency requests, as a new connection does not need to be established for each operation, and has a small resource overhead. However, scalability is limited as all database operations are serialized. +Below is example code which creates a connection and uses it to create a Database instance:

    +
    var opts = [ConnectionOptions]()
    +opts.append(ConnectionOptions.userName("myUser"))
    +opts.append(ConnectionOptions.password("myPassword"))
    +let connection = PostgreSQLConnection(host: host, port: port, options: opts)
    +let result = connection.connectSync()
    +guard let result.success else {
    +    // Handle error
    +    return
    +}
    +let db = Database(single: connection)
    +

    Declaration

    Swift

    -
    public init(_ pool: ConnectionPool)
    +
    public convenience init(single connection: Connection)
    @@ -242,9 +283,9 @@

    Declaration

  • @@ -252,14 +293,20 @@

    Declaration

    -

    Constructor for a custom connection generator

    +

    Create a Database instance with multiple connections, managed by a connection pool, allowing operations to be performed concurrently. These connections will remain open for the lifetime of the Database. +This connection strategy provides lower latency requests, as a new connection does not need to be established for each operation. You can choose between better performance or lower resource consumption by adjusting the number of connections in the pool. +Below is an example code which creates a connection pool and uses it to create a Database instance:

    +
    let connectionPool = PostgreSQLConnection.createPool(host: host, port: port, options: [.userName("myUser"), .password("myPassword")], poolOptions: ConnectionPoolOptions(initialCapacity: 5, maxCapacity: 10))
    +
    +let db = Database(connectionPool)
    +

    Declaration

    Swift

    -
    public init(generator: @escaping () -> Connection?)
    +
    public init(_ pool: ConnectionPool)
    @@ -269,9 +316,9 @@

    Declaration

  • @@ -279,15 +326,32 @@

    Declaration

    -

    Connection getter: either new connection from pool -or call the custom generator

    +

    Create a Database instance which uses short-lived connections that are generated on demand. A new Connection is created for every operation, and will be closed once the operation completes. +This connection strategy allows for minimal resource consumption when idle, and allows multiple operations to be performed concurrently. However, the process of establishing a connection will increase the time taken to process each operation. +Below is an example of a function that can be used as a connection generator and the call to create the Database instance:

    +
    func getConnectionAndRunTask(task: @escaping (Connection?, QueryError?) -> ()) {
    +    var opts = [ConnectionOptions]()
    +    opts.append(ConnectionOptions.userName("myUser"))
    +    opts.append(ConnectionOptions.password("myPassword"))
    +    let connection = PostgreSQLConnection(host: host, port: port, options: opts)
    +    connection.connect() { result in
    +        guard result.success else {
    +            // Handle error
    +            return task(nil, QueryError.connection(result.asError?.localizedDescription ?? "Unknown connection error"))
    +        }
    +    return task(connection, nil)
    +    }
    +}
    +
    +let db = Database(generator: getConnectionAndRunTask)```
    +

    Declaration

    Swift

    -
    public func getConnection() -> Connection?
    +
    public init(generator: @escaping (@escaping DatabaseTask) -> ())
    @@ -302,7 +366,7 @@

    Declaration

    diff --git a/docs/Classes/DatabaseDecoder.html b/docs/Classes/DatabaseDecoder.html index 6faff34..630771a 100644 --- a/docs/Classes/DatabaseDecoder.html +++ b/docs/Classes/DatabaseDecoder.html @@ -89,12 +89,39 @@
  • + + + + + + + + +
  • @@ -154,7 +181,7 @@

    Declaration

    diff --git a/docs/Classes/DatabaseEncoder.html b/docs/Classes/DatabaseEncoder.html index a732a2c..9c81680 100644 --- a/docs/Classes/DatabaseEncoder.html +++ b/docs/Classes/DatabaseEncoder.html @@ -89,12 +89,39 @@
  • + + + + + + + + +
  • @@ -154,7 +181,7 @@

    Declaration

    diff --git a/docs/Extensions.html b/docs/Extensions.html index c019029..3a3f249 100644 --- a/docs/Extensions.html +++ b/docs/Extensions.html @@ -88,12 +88,39 @@
  • + + + + + + + + +
  • @@ -133,7 +160,7 @@

    Extensions

    Declaration

    Swift

    -
    public typealias RequestError = KituraContracts.RequestError
    +
    public typealias RequestError = KituraContracts.RequestError
    @@ -148,7 +175,7 @@

    Declaration

    diff --git a/docs/Extensions/RequestError.html b/docs/Extensions/RequestError.html index 0a6054b..57d3688 100644 --- a/docs/Extensions/RequestError.html +++ b/docs/Extensions/RequestError.html @@ -89,12 +89,39 @@ + + + + + + + + + @@ -106,7 +133,7 @@

    RequestError

    -
    public typealias RequestError = KituraContracts.RequestError
    +
    public typealias RequestError = KituraContracts.RequestError
    @@ -122,9 +149,9 @@

    RequestError

  • - + - ormDatabaseNotInitialized + ormDatabaseNotInitialized
    @@ -139,7 +166,7 @@

    RequestError

    Declaration

    Swift

    -
    public static let ormDatabaseNotInitialized = RequestError(rawValue: 700, reason: "Database not Initialized")
    +
    public static let ormDatabaseNotInitialized = RequestError(rawValue: 700, reason: "Database not Initialized")
    @@ -149,9 +176,9 @@

    Declaration

  • - + - ormTableCreationError + ormTableCreationError
    @@ -166,7 +193,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormTableCreationError = RequestError(rawValue: 701)
    +
    public static let ormTableCreationError = RequestError(rawValue: 701)
    @@ -176,9 +203,9 @@

    Declaration

  • - + - ormCodableDecodingError + ormCodableDecodingError
    @@ -193,7 +220,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormCodableDecodingError = RequestError(rawValue: 702)
    +
    public static let ormCodableDecodingError = RequestError(rawValue: 702)
    @@ -203,9 +230,9 @@

    Declaration

  • - + - ormDatabaseDecodingError + ormDatabaseDecodingError
    @@ -220,7 +247,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormDatabaseDecodingError = RequestError(rawValue: 703)
    +
    public static let ormDatabaseDecodingError = RequestError(rawValue: 703)
    @@ -230,9 +257,9 @@

    Declaration

  • - + - ormDatabaseEncodingError + ormDatabaseEncodingError
    @@ -247,7 +274,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormDatabaseEncodingError = RequestError(rawValue: 704)
    +
    public static let ormDatabaseEncodingError = RequestError(rawValue: 704)
    @@ -257,9 +284,9 @@

    Declaration

  • - + - ormQueryError + ormQueryError
    @@ -274,7 +301,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormQueryError = RequestError(rawValue: 706)
    +
    public static let ormQueryError = RequestError(rawValue: 706)
    @@ -284,9 +311,9 @@

    Declaration

  • - + - ormNotFound + ormNotFound
    @@ -301,7 +328,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormNotFound = RequestError(rawValue: 707)
    +
    public static let ormNotFound = RequestError(rawValue: 707)
    @@ -311,9 +338,9 @@

    Declaration

  • - + - ormInvalidTableDefinition + ormInvalidTableDefinition
    @@ -328,7 +355,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormInvalidTableDefinition = RequestError(rawValue: 708)
    +
    public static let ormInvalidTableDefinition = RequestError(rawValue: 708)
    @@ -338,9 +365,9 @@

    Declaration

  • - + - ormIdentifierError + ormIdentifierError
    @@ -355,7 +382,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormIdentifierError = RequestError(rawValue: 709)
    +
    public static let ormIdentifierError = RequestError(rawValue: 709)
    @@ -365,9 +392,9 @@

    Declaration

  • - + - ormInternalError + ormInternalError
    @@ -382,7 +409,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormInternalError = RequestError(rawValue: 710)
    +
    public static let ormInternalError = RequestError(rawValue: 710)
    @@ -392,9 +419,9 @@

    Declaration

  • - + - ormConnectionFailed + ormConnectionFailed
    @@ -409,7 +436,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormConnectionFailed = RequestError(rawValue: 711, reason: "Failed to retrieve a connection from the database")
    +
    public static let ormConnectionFailed = RequestError(rawValue: 711, reason: "Failed to retrieve a connection from the database")
    @@ -424,7 +451,7 @@

    Declaration

    diff --git a/docs/Protocols.html b/docs/Protocols.html index fbc49f3..675e8f1 100644 --- a/docs/Protocols.html +++ b/docs/Protocols.html @@ -88,12 +88,39 @@
  • + + + + + + + + + @@ -148,7 +175,7 @@

    Declaration

    diff --git a/docs/Protocols/Model.html b/docs/Protocols/Model.html index 74ede76..511b7e6 100644 --- a/docs/Protocols/Model.html +++ b/docs/Protocols/Model.html @@ -89,12 +89,39 @@ + + + + + + + + + @@ -122,9 +149,9 @@

    Model

  • - + - tableName + tableName Default implementation @@ -157,9 +184,9 @@

    Declaration

  • - + - idColumnName + idColumnName Default implementation @@ -192,9 +219,9 @@

    Declaration

  • - + - idColumnType + idColumnType Default implementation @@ -217,7 +244,7 @@

    Default Implementation

    Declaration

    Swift

    -
    static var idColumnType: SQLDataType.Type
    +
    static var idColumnType: SQLDataType.Type
    @@ -285,7 +312,7 @@

    Default Implementation

    Declaration

    Swift

    -
    static func createTable(using db: Database?, _ onCompletion: @escaping (Bool?, RequestError?) -> Void)
    +
    static func createTable(using db: Database?, _ onCompletion: @escaping (Bool?, RequestError?) -> Void)
    @@ -353,7 +380,7 @@

    Default Implementation

    Declaration

    Swift

    -
    static func dropTable(using db: Database?, _ onCompletion: @escaping (Bool?, RequestError?) -> Void)
    +
    static func dropTable(using db: Database?, _ onCompletion: @escaping (Bool?, RequestError?) -> Void)
    @@ -390,7 +417,7 @@

    Default Implementation

    Declaration

    Swift

    -
    func save(using db: Database?, _ onCompletion: @escaping (Self?, RequestError?) -> Void)
    +
    func save(using db: Database?, _ onCompletion: @escaping (Self?, RequestError?) -> Void)
    @@ -418,7 +445,7 @@

    Declaration

    Declaration

    Swift

    -
    func save<I: Identifier>(using db: Database?, _ onCompletion: @escaping (I?, Self?, RequestError?) -> Void)
    +
    func save<I: Identifier>(using db: Database?, _ onCompletion: @escaping (I?, Self?, RequestError?) -> Void)
    @@ -428,9 +455,9 @@

    Declaration

  • - - - find(id:using:_:) + + + update(id:using:_:) Default implementation @@ -441,20 +468,19 @@

    Declaration

    -

    Call to find a model in the database with an id that accepts a completion -handler. The callback is passed the model or an error

    +

    Call to update a model in the database with an id that accepts a completion +handler. The callback is passed a updated model or an error

    Default Implementation

    -

    Find a model with an id

    - +

    Declaration

    Swift

    -
    static func find<I: Identifier>(id: I, using db: Database?, _ onCompletion: @escaping (Self?, RequestError?) -> Void)
    +
    func update<I: Identifier>(id: I, using db: Database?, _ onCompletion: @escaping (Self?, RequestError?) -> Void)
    @@ -464,9 +490,9 @@

    Declaration

  • - - - findAll(using:_:) + + + delete(id:using:_:) Default implementation @@ -477,20 +503,19 @@

    Declaration

    -

    Call to find all the models in the database that accepts a completion -handler. The callback is passed an array of models or an error

    +

    Call to delete a model in the database with an id that accepts a completion +handler. The callback is passed an optional error

    Default Implementation

    -

    Find all the models

    - +

    Declaration

    Swift

    -
    static func findAll(using db: Database?, _ onCompletion: @escaping ([Self]?, RequestError?) -> Void)
    +
    static func delete(id: Identifier, using db: Database?, _ onCompletion: @escaping (RequestError?) -> Void)
    @@ -500,25 +525,32 @@

    Declaration

  • - - - findAll(using:_:) + + + deleteAll(using:_:) + + Default implementation +
    -

    Call to find all the models in the database that accepts a completion -handler. The callback is passed an array of tuples (id, model) or an error

    +

    Call to delete all the models in the database that accepts a completion +handler. The callback is passed an optional error

    +
    +

    Default Implementation

    +
    +

    Declaration

    Swift

    -
    static func findAll<I: Identifier>(using db: Database?, _ onCompletion: @escaping ([(I, Self)]?, RequestError?) -> Void)
    +
    static func deleteAll(using db: Database?, _ onCompletion: @escaping (RequestError?) -> Void)
    @@ -528,25 +560,33 @@

    Declaration

  • - - - findAll(using:_:) + + + deleteAll(using:matching:_:) + + Default implementation +
    -

    Call to find all the models in the database that accepts a completion -handler. The callback is passed a dictionary [id: model] or an error

    +

    Call to delete all the models in the database mathcing the QueryParams that accepts a completion +handler. The callback is passed an optional error

    + +
    +

    Default Implementation

    +
    +

    Delete all the models matching the QueryParams

    Declaration

    Swift

    -
    static func findAll<I: Identifier>(using db: Database?, _ onCompletion: @escaping ([I: Self]?, RequestError?) -> Void)
    +
    static func deleteAll<Q: QueryParams>(using db: Database?, matching queryParams:Q?, _ onCompletion: @escaping (RequestError?) -> Void)
    @@ -556,9 +596,9 @@

    Declaration

  • - - - findAll(using:matching:_:) + + + getTable() Default implementation @@ -569,22 +609,18 @@

    Declaration

    -

    Call to find all the models in the database matching the QueryParams that accepts a completion -handler. The callback is passed an array of models or an error

    +

    Call to get the table of the model

    Default Implementation

    -

    Find all the models matching the QueryParams

    -

    Find all the models matching the QueryParams

    -

    Find all the models matching the QueryParams

    - +

    Declaration

    Swift

    -
    static func findAll<Q: QueryParams>(using db: Database?, matching queryParams: Q, _ onCompletion: @escaping ([Self]?, RequestError?) -> Void)
    +
    static func getTable() throws -> Table
    @@ -594,25 +630,33 @@

    Declaration

  • - - - findAll(using:matching:_:) + + + find(id:using:_:) + + Default implementation +
    -

    Call to find all the models in the database matching the QueryParams that accepts a completion -handler. The callback is passed an array of tuples (id, model) or an error

    +

    Call to find a model in the database with an id that accepts a completion +handler. The callback is passed the model or an error

    + +
    +

    Default Implementation

    +
    +

    Find a model with an id

    Declaration

    Swift

    -
    static func findAll<Q: QueryParams, I: Identifier>(using db: Database?, matching queryParams: Q, _ onCompletion: @escaping ([(I, Self)]?, RequestError?) -> Void)
    +
    static func find<I: Identifier>(id: I, using db: Database?, _ onCompletion: @escaping (Self?, RequestError?) -> Void)
    @@ -622,25 +666,33 @@

    Declaration

  • - - - findAll(using:matching:_:) + + + findAll(using:_:) + + Default implementation +
    -

    Call to find all the models in the database matching the QueryParams that accepts a completion -handler. The callback is passed a dictionary [id: model] or an error

    +

    Call to find all the models in the database that accepts a completion +handler. The callback is passed an array of models or an error

    + +
    +

    Default Implementation

    +
    +

    Find all the models

    Declaration

    Swift

    -
    static func findAll<Q: QueryParams, I: Identifier>(using db: Database?, matching queryParams: Q, _ onCompletion: @escaping ([I: Self]?, RequestError?) -> Void)
    +
    static func findAll(using db: Database?, _ onCompletion: @escaping ([Self]?, RequestError?) -> Void)
    @@ -650,32 +702,25 @@

    Declaration

  • - - - update(id:using:_:) + + + findAll(using:_:) - - Default implementation -
    -

    Call to update a model in the database with an id that accepts a completion -handler. The callback is passed a updated model or an error

    +

    Call to find all the models in the database that accepts a completion +handler. The callback is passed an array of tuples (id, model) or an error

    -
    -

    Default Implementation

    -
    -

    Declaration

    Swift

    -
    func update<I: Identifier>(id: I, using db: Database?, _ onCompletion: @escaping (Self?, RequestError?) -> Void)
    +
    static func findAll<I: Identifier>(using db: Database?, _ onCompletion: @escaping ([(I, Self)]?, RequestError?) -> Void)
    @@ -685,32 +730,25 @@

    Declaration

  • - - - delete(id:using:_:) + + + findAll(using:_:) - - Default implementation -
    -

    Call to delete a model in the database with an id that accepts a completion -handler. The callback is passed an optional error

    +

    Call to find all the models in the database that accepts a completion +handler. The callback is passed a dictionary [id: model] or an error

    -
    -

    Default Implementation

    -
    -

    Declaration

    Swift

    -
    static func delete(id: Identifier, using db: Database?, _ onCompletion: @escaping (RequestError?) -> Void)
    +
    static func findAll<I: Identifier>(using db: Database?, _ onCompletion: @escaping ([I: Self]?, RequestError?) -> Void)
    @@ -720,9 +758,9 @@

    Declaration

  • - - - deleteAll(using:_:) + + + findAll(using:matching:_:) Default implementation @@ -733,19 +771,21 @@

    Declaration

    -

    Call to delete all the models in the database that accepts a completion -handler. The callback is passed an optional error

    +

    Call to find all the models in the database matching the QueryParams that accepts a completion +handler. The callback is passed an array of models or an error

    Default Implementation

    - +

    Find all the models matching the QueryParams

    +

    Find all the models matching the QueryParams

    +

    Declaration

    Swift

    -
    static func deleteAll(using db: Database?, _ onCompletion: @escaping (RequestError?) -> Void)
    +
    static func findAll<Q: QueryParams>(using db: Database?, matching queryParams: Q?, _ onCompletion: @escaping ([Self]?, RequestError?) -> Void)
    @@ -755,33 +795,25 @@

    Declaration

  • - - - deleteAll(using:matching:_:) + + + findAll(using:matching:_:) - - Default implementation -
    -

    Call to delete all the models in the database mathcing the QueryParams that accepts a completion -handler. The callback is passed an optional error

    - -
    -

    Default Implementation

    -
    -

    Delete all the models matching the QueryParams

    +

    Call to find all the models in the database matching the QueryParams that accepts a completion +handler. The callback is passed an array of tuples (id, model) or an error

    Declaration

    Swift

    -
    static func deleteAll<Q: QueryParams>(using db: Database?, matching queryParams:Q, _ onCompletion: @escaping (RequestError?) -> Void)
    +
    static func findAll<Q: QueryParams, I: Identifier>(using db: Database?, matching queryParams: Q?, _ onCompletion: @escaping ([(I, Self)]?, RequestError?) -> Void)
    @@ -791,31 +823,25 @@

    Declaration

  • - - - getTable() + + + findAll(using:matching:_:) - - Default implementation -
    -

    Call to get the table of the model

    +

    Call to find all the models in the database matching the QueryParams that accepts a completion +handler. The callback is passed a dictionary [id: model] or an error

    -
    -

    Default Implementation

    -
    -

    Declaration

    Swift

    -
    static func getTable() throws -> Table
    +
    static func findAll<Q: QueryParams, I: Identifier>(using db: Database?, matching queryParams: Q?, _ onCompletion: @escaping ([I: Self]?, RequestError?) -> Void)
    @@ -830,7 +856,7 @@

    Declaration

    diff --git a/docs/Typealiases.html b/docs/Typealiases.html index daace50..80971a4 100644 --- a/docs/Typealiases.html +++ b/docs/Typealiases.html @@ -88,12 +88,39 @@
  • + + + + + + + + +
  • @@ -170,6 +197,33 @@

    Declaration

  • +
  • +
    + + + + SQLDataType + +
    +
    +
    +
    +
    +
    +

    Type Alias for SQLDataType from SwiftKuery

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias SQLDataType = SwiftKuery.SQLDataType
    + +
    +
    +
    +
    +
  • @@ -183,7 +237,7 @@

    Declaration

    -

    Type Alias for QueryParams from KituraContracts

    +

    Public TypeAlias for QueryParams Type from KituraContracts

    @@ -197,6 +251,222 @@

    Declaration

  • +
  • +
    + + + + GreaterThan + +
    +
    +
    +
    +
    +
    +

    Public TypeAlias for GreaterThan Type from KituraContracts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias GreaterThan = KituraContracts.GreaterThan
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + LowerThan + +
    +
    +
    +
    +
    +
    +

    Public TypeAlias for LowerThan Type from KituraContracts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias LowerThan = KituraContracts.LowerThan
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + GreaterThanOrEqual + +
    +
    +
    +
    +
    +
    +

    Public TypeAlias for GreaterThanOrEqual Type from KituraContracts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias GreaterThanOrEqual = KituraContracts.GreaterThanOrEqual
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + LowerThanOrEqual + +
    +
    +
    +
    +
    +
    +

    Public TypeAlias for LowerThanOrEqual Type from KituraContracts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias LowerThanOrEqual = KituraContracts.LowerThanOrEqual
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + InclusiveRange + +
    +
    +
    +
    +
    +
    +

    Public TypeAlias for InclusiveRange Type from KituraContracts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias InclusiveRange = KituraContracts.InclusiveRange
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + ExclusiveRange + +
    +
    +
    +
    +
    +
    +

    Public TypeAlias for ExclusiveRange Type from KituraContracts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias ExclusiveRange = KituraContracts.ExclusiveRange
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + Pagination + +
    +
    +
    +
    +
    +
    +

    Public TypeAlias for Pagination Type from KituraContracts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias Pagination = KituraContracts.Pagination
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + Ordering + +
    +
    +
    +
    +
    +
    +

    Public TypeAlias for Ordering Type from KituraContracts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias Ordering = KituraContracts.Ordering
    + +
    +
    +
    +
    +
  • @@ -205,7 +475,7 @@

    Declaration

  • diff --git a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Classes.html b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Classes.html index 1985684..331e747 100644 --- a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Classes.html +++ b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Classes.html @@ -88,12 +88,39 @@
  • + + + + + + + + +
  • @@ -255,7 +282,7 @@

    Declaration

    diff --git a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Classes/Database.html b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Classes/Database.html index e652b54..90e8997 100644 --- a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Classes/Database.html +++ b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Classes/Database.html @@ -89,12 +89,39 @@
  • + + + + + + + + +
  • @@ -134,9 +161,9 @@

    Database

  • - - - default + + + DatabaseTask
    @@ -144,14 +171,14 @@

    Database

    -

    Global default Database for the application

    +

    Definition of a DatabaseTask completion handler which accepts an optional Connection and optional Error

    Declaration

    Swift

    -
    public static var `default`: Database?
    +
    public typealias DatabaseTask = (Connection?, QueryError?) -> ()
    @@ -161,9 +188,9 @@

    Declaration

  • - - - tableInfo + + + default
    @@ -171,14 +198,14 @@

    Declaration

    -

    Instance of TableInfo containing cached tables

    +

    Global default Database for the application

    Declaration

    Swift

    -
    public static var tableInfo = TableInfo()
    +
    public static var `default`: Database?
    @@ -188,9 +215,9 @@

    Declaration

  • - - - init(single:) + + + tableInfo
    @@ -198,14 +225,14 @@

    Declaration

    -

    Constructor for a single connection which becomes a connection pool

    +

    Instance of TableInfo containing cached tables

    Declaration

    Swift

    -
    public convenience init(single connection: Connection)
    +
    public static var tableInfo = TableInfo()
    @@ -215,9 +242,9 @@

    Declaration

  • - - - init(_:) + + + init(single:)
    @@ -225,14 +252,28 @@

    Declaration

    -

    Default constructor for a connection pool

    +

    Create a Database instance which uses a single connection to perform each operation. The connection will remain open for the lifetime of the Database. +It is safe for you to issue concurrent operations on the database: the ORM will ensure those operations are executed sequentially. +This connection strategy provides lower latency requests, as a new connection does not need to be established for each operation, and has a small resource overhead. However, scalability is limited as all database operations are serialized. +Below is example code which creates a connection and uses it to create a Database instance:

    +
    var opts = [ConnectionOptions]()
    +opts.append(ConnectionOptions.userName("myUser"))
    +opts.append(ConnectionOptions.password("myPassword"))
    +let connection = PostgreSQLConnection(host: host, port: port, options: opts)
    +let result = connection.connectSync()
    +guard let result.success else {
    +    // Handle error
    +    return
    +}
    +let db = Database(single: connection)
    +

    Declaration

    Swift

    -
    public init(_ pool: ConnectionPool)
    +
    public convenience init(single connection: Connection)
    @@ -242,9 +283,9 @@

    Declaration

  • @@ -252,14 +293,20 @@

    Declaration

    -

    Constructor for a custom connection generator

    +

    Create a Database instance with multiple connections, managed by a connection pool, allowing operations to be performed concurrently. These connections will remain open for the lifetime of the Database. +This connection strategy provides lower latency requests, as a new connection does not need to be established for each operation. You can choose between better performance or lower resource consumption by adjusting the number of connections in the pool. +Below is an example code which creates a connection pool and uses it to create a Database instance:

    +
    let connectionPool = PostgreSQLConnection.createPool(host: host, port: port, options: [.userName("myUser"), .password("myPassword")], poolOptions: ConnectionPoolOptions(initialCapacity: 5, maxCapacity: 10))
    +
    +let db = Database(connectionPool)
    +

    Declaration

    Swift

    -
    public init(generator: @escaping () -> Connection?)
    +
    public init(_ pool: ConnectionPool)
    @@ -269,9 +316,9 @@

    Declaration

  • @@ -279,15 +326,32 @@

    Declaration

    -

    Connection getter: either new connection from pool -or call the custom generator

    +

    Create a Database instance which uses short-lived connections that are generated on demand. A new Connection is created for every operation, and will be closed once the operation completes. +This connection strategy allows for minimal resource consumption when idle, and allows multiple operations to be performed concurrently. However, the process of establishing a connection will increase the time taken to process each operation. +Below is an example of a function that can be used as a connection generator and the call to create the Database instance:

    +
    func getConnectionAndRunTask(task: @escaping (Connection?, QueryError?) -> ()) {
    +    var opts = [ConnectionOptions]()
    +    opts.append(ConnectionOptions.userName("myUser"))
    +    opts.append(ConnectionOptions.password("myPassword"))
    +    let connection = PostgreSQLConnection(host: host, port: port, options: opts)
    +    connection.connect() { result in
    +        guard result.success else {
    +            // Handle error
    +            return task(nil, QueryError.connection(result.asError?.localizedDescription ?? "Unknown connection error"))
    +        }
    +    return task(connection, nil)
    +    }
    +}
    +
    +let db = Database(generator: getConnectionAndRunTask)```
    +

    Declaration

    Swift

    -
    public func getConnection() -> Connection?
    +
    public init(generator: @escaping (@escaping DatabaseTask) -> ())
    @@ -302,7 +366,7 @@

    Declaration

    diff --git a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Classes/DatabaseDecoder.html b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Classes/DatabaseDecoder.html index 6faff34..630771a 100644 --- a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Classes/DatabaseDecoder.html +++ b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Classes/DatabaseDecoder.html @@ -89,12 +89,39 @@
  • + + + + + + + + +
  • @@ -154,7 +181,7 @@

    Declaration

    diff --git a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Classes/DatabaseEncoder.html b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Classes/DatabaseEncoder.html index a732a2c..9c81680 100644 --- a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Classes/DatabaseEncoder.html +++ b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Classes/DatabaseEncoder.html @@ -89,12 +89,39 @@
  • + + + + + + + + +
  • @@ -154,7 +181,7 @@

    Declaration

    diff --git a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Extensions.html b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Extensions.html index c019029..3a3f249 100644 --- a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Extensions.html +++ b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Extensions.html @@ -88,12 +88,39 @@
  • + + + + + + + + +
  • @@ -133,7 +160,7 @@

    Extensions

    Declaration

    Swift

    -
    public typealias RequestError = KituraContracts.RequestError
    +
    public typealias RequestError = KituraContracts.RequestError
    @@ -148,7 +175,7 @@

    Declaration

  • diff --git a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Extensions/RequestError.html b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Extensions/RequestError.html index 0a6054b..57d3688 100644 --- a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Extensions/RequestError.html +++ b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Extensions/RequestError.html @@ -89,12 +89,39 @@
  • + + + + + + + + +
  • @@ -106,7 +133,7 @@

    RequestError

    -
    public typealias RequestError = KituraContracts.RequestError
    +
    public typealias RequestError = KituraContracts.RequestError
    @@ -122,9 +149,9 @@

    RequestError

  • - + - ormDatabaseNotInitialized + ormDatabaseNotInitialized
    @@ -139,7 +166,7 @@

    RequestError

    Declaration

    Swift

    -
    public static let ormDatabaseNotInitialized = RequestError(rawValue: 700, reason: "Database not Initialized")
    +
    public static let ormDatabaseNotInitialized = RequestError(rawValue: 700, reason: "Database not Initialized")
    @@ -149,9 +176,9 @@

    Declaration

  • - + - ormTableCreationError + ormTableCreationError
    @@ -166,7 +193,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormTableCreationError = RequestError(rawValue: 701)
    +
    public static let ormTableCreationError = RequestError(rawValue: 701)
    @@ -176,9 +203,9 @@

    Declaration

  • - + - ormCodableDecodingError + ormCodableDecodingError
    @@ -193,7 +220,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormCodableDecodingError = RequestError(rawValue: 702)
    +
    public static let ormCodableDecodingError = RequestError(rawValue: 702)
    @@ -203,9 +230,9 @@

    Declaration

  • - + - ormDatabaseDecodingError + ormDatabaseDecodingError
    @@ -220,7 +247,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormDatabaseDecodingError = RequestError(rawValue: 703)
    +
    public static let ormDatabaseDecodingError = RequestError(rawValue: 703)
    @@ -230,9 +257,9 @@

    Declaration

  • - + - ormDatabaseEncodingError + ormDatabaseEncodingError
    @@ -247,7 +274,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormDatabaseEncodingError = RequestError(rawValue: 704)
    +
    public static let ormDatabaseEncodingError = RequestError(rawValue: 704)
    @@ -257,9 +284,9 @@

    Declaration

  • - + - ormQueryError + ormQueryError
    @@ -274,7 +301,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormQueryError = RequestError(rawValue: 706)
    +
    public static let ormQueryError = RequestError(rawValue: 706)
    @@ -284,9 +311,9 @@

    Declaration

  • - + - ormNotFound + ormNotFound
    @@ -301,7 +328,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormNotFound = RequestError(rawValue: 707)
    +
    public static let ormNotFound = RequestError(rawValue: 707)
    @@ -311,9 +338,9 @@

    Declaration

  • - + - ormInvalidTableDefinition + ormInvalidTableDefinition
    @@ -328,7 +355,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormInvalidTableDefinition = RequestError(rawValue: 708)
    +
    public static let ormInvalidTableDefinition = RequestError(rawValue: 708)
    @@ -338,9 +365,9 @@

    Declaration

  • - + - ormIdentifierError + ormIdentifierError
    @@ -355,7 +382,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormIdentifierError = RequestError(rawValue: 709)
    +
    public static let ormIdentifierError = RequestError(rawValue: 709)
    @@ -365,9 +392,9 @@

    Declaration

  • - + - ormInternalError + ormInternalError
    @@ -382,7 +409,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormInternalError = RequestError(rawValue: 710)
    +
    public static let ormInternalError = RequestError(rawValue: 710)
    @@ -392,9 +419,9 @@

    Declaration

  • - + - ormConnectionFailed + ormConnectionFailed
    @@ -409,7 +436,7 @@

    Declaration

    Declaration

    Swift

    -
    public static let ormConnectionFailed = RequestError(rawValue: 711, reason: "Failed to retrieve a connection from the database")
    +
    public static let ormConnectionFailed = RequestError(rawValue: 711, reason: "Failed to retrieve a connection from the database")
    @@ -424,7 +451,7 @@

    Declaration

    diff --git a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Protocols.html b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Protocols.html index fbc49f3..675e8f1 100644 --- a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Protocols.html +++ b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Protocols.html @@ -88,12 +88,39 @@
  • + + + + + + + + + @@ -148,7 +175,7 @@

    Declaration

    diff --git a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Protocols/Model.html b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Protocols/Model.html index 74ede76..511b7e6 100644 --- a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Protocols/Model.html +++ b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Protocols/Model.html @@ -89,12 +89,39 @@ + + + + + + + + + @@ -122,9 +149,9 @@

    Model

  • - + - tableName + tableName Default implementation @@ -157,9 +184,9 @@

    Declaration

  • - + - idColumnName + idColumnName Default implementation @@ -192,9 +219,9 @@

    Declaration

  • - + - idColumnType + idColumnType Default implementation @@ -217,7 +244,7 @@

    Default Implementation

    Declaration

    Swift

    -
    static var idColumnType: SQLDataType.Type
    +
    static var idColumnType: SQLDataType.Type
    @@ -285,7 +312,7 @@

    Default Implementation

    Declaration

    Swift

    -
    static func createTable(using db: Database?, _ onCompletion: @escaping (Bool?, RequestError?) -> Void)
    +
    static func createTable(using db: Database?, _ onCompletion: @escaping (Bool?, RequestError?) -> Void)
    @@ -353,7 +380,7 @@

    Default Implementation

    Declaration

    Swift

    -
    static func dropTable(using db: Database?, _ onCompletion: @escaping (Bool?, RequestError?) -> Void)
    +
    static func dropTable(using db: Database?, _ onCompletion: @escaping (Bool?, RequestError?) -> Void)
    @@ -390,7 +417,7 @@

    Default Implementation

    Declaration

    Swift

    -
    func save(using db: Database?, _ onCompletion: @escaping (Self?, RequestError?) -> Void)
    +
    func save(using db: Database?, _ onCompletion: @escaping (Self?, RequestError?) -> Void)
    @@ -418,7 +445,7 @@

    Declaration

    Declaration

    Swift

    -
    func save<I: Identifier>(using db: Database?, _ onCompletion: @escaping (I?, Self?, RequestError?) -> Void)
    +
    func save<I: Identifier>(using db: Database?, _ onCompletion: @escaping (I?, Self?, RequestError?) -> Void)
    @@ -428,9 +455,9 @@

    Declaration

  • - - - find(id:using:_:) + + + update(id:using:_:) Default implementation @@ -441,20 +468,19 @@

    Declaration

    -

    Call to find a model in the database with an id that accepts a completion -handler. The callback is passed the model or an error

    +

    Call to update a model in the database with an id that accepts a completion +handler. The callback is passed a updated model or an error

    Default Implementation

    -

    Find a model with an id

    - +

    Declaration

    Swift

    -
    static func find<I: Identifier>(id: I, using db: Database?, _ onCompletion: @escaping (Self?, RequestError?) -> Void)
    +
    func update<I: Identifier>(id: I, using db: Database?, _ onCompletion: @escaping (Self?, RequestError?) -> Void)
    @@ -464,9 +490,9 @@

    Declaration

  • - - - findAll(using:_:) + + + delete(id:using:_:) Default implementation @@ -477,20 +503,19 @@

    Declaration

    -

    Call to find all the models in the database that accepts a completion -handler. The callback is passed an array of models or an error

    +

    Call to delete a model in the database with an id that accepts a completion +handler. The callback is passed an optional error

    Default Implementation

    -

    Find all the models

    - +

    Declaration

    Swift

    -
    static func findAll(using db: Database?, _ onCompletion: @escaping ([Self]?, RequestError?) -> Void)
    +
    static func delete(id: Identifier, using db: Database?, _ onCompletion: @escaping (RequestError?) -> Void)
    @@ -500,25 +525,32 @@

    Declaration

  • - - - findAll(using:_:) + + + deleteAll(using:_:) + + Default implementation +
    -

    Call to find all the models in the database that accepts a completion -handler. The callback is passed an array of tuples (id, model) or an error

    +

    Call to delete all the models in the database that accepts a completion +handler. The callback is passed an optional error

    +
    +

    Default Implementation

    +
    +

    Declaration

    Swift

    -
    static func findAll<I: Identifier>(using db: Database?, _ onCompletion: @escaping ([(I, Self)]?, RequestError?) -> Void)
    +
    static func deleteAll(using db: Database?, _ onCompletion: @escaping (RequestError?) -> Void)
    @@ -528,25 +560,33 @@

    Declaration

  • - - - findAll(using:_:) + + + deleteAll(using:matching:_:) + + Default implementation +
    -

    Call to find all the models in the database that accepts a completion -handler. The callback is passed a dictionary [id: model] or an error

    +

    Call to delete all the models in the database mathcing the QueryParams that accepts a completion +handler. The callback is passed an optional error

    + +
    +

    Default Implementation

    +
    +

    Delete all the models matching the QueryParams

    Declaration

    Swift

    -
    static func findAll<I: Identifier>(using db: Database?, _ onCompletion: @escaping ([I: Self]?, RequestError?) -> Void)
    +
    static func deleteAll<Q: QueryParams>(using db: Database?, matching queryParams:Q?, _ onCompletion: @escaping (RequestError?) -> Void)
    @@ -556,9 +596,9 @@

    Declaration

  • - - - findAll(using:matching:_:) + + + getTable() Default implementation @@ -569,22 +609,18 @@

    Declaration

    -

    Call to find all the models in the database matching the QueryParams that accepts a completion -handler. The callback is passed an array of models or an error

    +

    Call to get the table of the model

    Default Implementation

    -

    Find all the models matching the QueryParams

    -

    Find all the models matching the QueryParams

    -

    Find all the models matching the QueryParams

    - +

    Declaration

    Swift

    -
    static func findAll<Q: QueryParams>(using db: Database?, matching queryParams: Q, _ onCompletion: @escaping ([Self]?, RequestError?) -> Void)
    +
    static func getTable() throws -> Table
    @@ -594,25 +630,33 @@

    Declaration

  • - - - findAll(using:matching:_:) + + + find(id:using:_:) + + Default implementation +
    -

    Call to find all the models in the database matching the QueryParams that accepts a completion -handler. The callback is passed an array of tuples (id, model) or an error

    +

    Call to find a model in the database with an id that accepts a completion +handler. The callback is passed the model or an error

    + +
    +

    Default Implementation

    +
    +

    Find a model with an id

    Declaration

    Swift

    -
    static func findAll<Q: QueryParams, I: Identifier>(using db: Database?, matching queryParams: Q, _ onCompletion: @escaping ([(I, Self)]?, RequestError?) -> Void)
    +
    static func find<I: Identifier>(id: I, using db: Database?, _ onCompletion: @escaping (Self?, RequestError?) -> Void)
    @@ -622,25 +666,33 @@

    Declaration

  • - - - findAll(using:matching:_:) + + + findAll(using:_:) + + Default implementation +
    -

    Call to find all the models in the database matching the QueryParams that accepts a completion -handler. The callback is passed a dictionary [id: model] or an error

    +

    Call to find all the models in the database that accepts a completion +handler. The callback is passed an array of models or an error

    + +
    +

    Default Implementation

    +
    +

    Find all the models

    Declaration

    Swift

    -
    static func findAll<Q: QueryParams, I: Identifier>(using db: Database?, matching queryParams: Q, _ onCompletion: @escaping ([I: Self]?, RequestError?) -> Void)
    +
    static func findAll(using db: Database?, _ onCompletion: @escaping ([Self]?, RequestError?) -> Void)
    @@ -650,32 +702,25 @@

    Declaration

  • - - - update(id:using:_:) + + + findAll(using:_:) - - Default implementation -
    -

    Call to update a model in the database with an id that accepts a completion -handler. The callback is passed a updated model or an error

    +

    Call to find all the models in the database that accepts a completion +handler. The callback is passed an array of tuples (id, model) or an error

    -
    -

    Default Implementation

    -
    -

    Declaration

    Swift

    -
    func update<I: Identifier>(id: I, using db: Database?, _ onCompletion: @escaping (Self?, RequestError?) -> Void)
    +
    static func findAll<I: Identifier>(using db: Database?, _ onCompletion: @escaping ([(I, Self)]?, RequestError?) -> Void)
    @@ -685,32 +730,25 @@

    Declaration

  • - - - delete(id:using:_:) + + + findAll(using:_:) - - Default implementation -
    -

    Call to delete a model in the database with an id that accepts a completion -handler. The callback is passed an optional error

    +

    Call to find all the models in the database that accepts a completion +handler. The callback is passed a dictionary [id: model] or an error

    -
    -

    Default Implementation

    -
    -

    Declaration

    Swift

    -
    static func delete(id: Identifier, using db: Database?, _ onCompletion: @escaping (RequestError?) -> Void)
    +
    static func findAll<I: Identifier>(using db: Database?, _ onCompletion: @escaping ([I: Self]?, RequestError?) -> Void)
    @@ -720,9 +758,9 @@

    Declaration

  • - - - deleteAll(using:_:) + + + findAll(using:matching:_:) Default implementation @@ -733,19 +771,21 @@

    Declaration

    -

    Call to delete all the models in the database that accepts a completion -handler. The callback is passed an optional error

    +

    Call to find all the models in the database matching the QueryParams that accepts a completion +handler. The callback is passed an array of models or an error

    Default Implementation

    - +

    Find all the models matching the QueryParams

    +

    Find all the models matching the QueryParams

    +

    Declaration

    Swift

    -
    static func deleteAll(using db: Database?, _ onCompletion: @escaping (RequestError?) -> Void)
    +
    static func findAll<Q: QueryParams>(using db: Database?, matching queryParams: Q?, _ onCompletion: @escaping ([Self]?, RequestError?) -> Void)
    @@ -755,33 +795,25 @@

    Declaration

  • - - - deleteAll(using:matching:_:) + + + findAll(using:matching:_:) - - Default implementation -
    -

    Call to delete all the models in the database mathcing the QueryParams that accepts a completion -handler. The callback is passed an optional error

    - -
    -

    Default Implementation

    -
    -

    Delete all the models matching the QueryParams

    +

    Call to find all the models in the database matching the QueryParams that accepts a completion +handler. The callback is passed an array of tuples (id, model) or an error

    Declaration

    Swift

    -
    static func deleteAll<Q: QueryParams>(using db: Database?, matching queryParams:Q, _ onCompletion: @escaping (RequestError?) -> Void)
    +
    static func findAll<Q: QueryParams, I: Identifier>(using db: Database?, matching queryParams: Q?, _ onCompletion: @escaping ([(I, Self)]?, RequestError?) -> Void)
    @@ -791,31 +823,25 @@

    Declaration

  • - - - getTable() + + + findAll(using:matching:_:) - - Default implementation -
    -

    Call to get the table of the model

    +

    Call to find all the models in the database matching the QueryParams that accepts a completion +handler. The callback is passed a dictionary [id: model] or an error

    -
    -

    Default Implementation

    -
    -

    Declaration

    Swift

    -
    static func getTable() throws -> Table
    +
    static func findAll<Q: QueryParams, I: Identifier>(using db: Database?, matching queryParams: Q?, _ onCompletion: @escaping ([I: Self]?, RequestError?) -> Void)
    @@ -830,7 +856,7 @@

    Declaration

    diff --git a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Typealiases.html b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Typealiases.html index daace50..80971a4 100644 --- a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Typealiases.html +++ b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/Typealiases.html @@ -88,12 +88,39 @@
  • + + + + + + + + +
  • @@ -170,6 +197,33 @@

    Declaration

  • +
  • +
    + + + + SQLDataType + +
    +
    +
    +
    +
    +
    +

    Type Alias for SQLDataType from SwiftKuery

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias SQLDataType = SwiftKuery.SQLDataType
    + +
    +
    +
    +
    +
  • @@ -183,7 +237,7 @@

    Declaration

    -

    Type Alias for QueryParams from KituraContracts

    +

    Public TypeAlias for QueryParams Type from KituraContracts

    @@ -197,6 +251,222 @@

    Declaration

  • +
  • +
    + + + + GreaterThan + +
    +
    +
    +
    +
    +
    +

    Public TypeAlias for GreaterThan Type from KituraContracts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias GreaterThan = KituraContracts.GreaterThan
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + LowerThan + +
    +
    +
    +
    +
    +
    +

    Public TypeAlias for LowerThan Type from KituraContracts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias LowerThan = KituraContracts.LowerThan
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + GreaterThanOrEqual + +
    +
    +
    +
    +
    +
    +

    Public TypeAlias for GreaterThanOrEqual Type from KituraContracts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias GreaterThanOrEqual = KituraContracts.GreaterThanOrEqual
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + LowerThanOrEqual + +
    +
    +
    +
    +
    +
    +

    Public TypeAlias for LowerThanOrEqual Type from KituraContracts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias LowerThanOrEqual = KituraContracts.LowerThanOrEqual
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + InclusiveRange + +
    +
    +
    +
    +
    +
    +

    Public TypeAlias for InclusiveRange Type from KituraContracts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias InclusiveRange = KituraContracts.InclusiveRange
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + ExclusiveRange + +
    +
    +
    +
    +
    +
    +

    Public TypeAlias for ExclusiveRange Type from KituraContracts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias ExclusiveRange = KituraContracts.ExclusiveRange
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + Pagination + +
    +
    +
    +
    +
    +
    +

    Public TypeAlias for Pagination Type from KituraContracts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias Pagination = KituraContracts.Pagination
    + +
    +
    +
    +
    +
  • +
  • +
    + + + + Ordering + +
    +
    +
    +
    +
    +
    +

    Public TypeAlias for Ordering Type from KituraContracts

    + +
    +
    +

    Declaration

    +
    +

    Swift

    +
    public typealias Ordering = KituraContracts.Ordering
    + +
    +
    +
    +
    +
  • @@ -205,7 +475,7 @@

    Declaration

  • diff --git a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/index.html b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/index.html index dec2331..0bff6fd 100644 --- a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/index.html +++ b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/index.html @@ -88,12 +88,39 @@
  • + + + + + + + + +
  • @@ -110,13 +137,13 @@

    - - Docs + + APIDoc Build Status - Master - Mac OS X + macOS Linux Apache 2 @@ -124,14 +151,13 @@

    Swift-Kuery-ORM

    -

    Summary

    Swift-Kuery-ORM is an ORM (Object Relational Mapping) library built for Swift. Using it allows you to simplify persistence of model objects with your server.

    Swift-Kuery-ORM is built on top of Swift-Kuery, which means that its possible to use Swift-Kuery to customize SQL queries made to the database, if the functionality of the ORM is insufficient.

    The Model Protocol

    -

    The key component of Swift-Kuery-ORM is the protocol Model.

    +

    The key component of Swift-Kuery-ORM is the protocol Model.

    Let’s propose a struct to use as an example. We can declare an object that looks like so:

    struct Grade: Codable {
    @@ -157,15 +183,15 @@ 

    The Model Protocol

    The Model protocol is the key to using the ORM. Let’s walk through how to fully set up an application to make use of the ORM.

    Example

    -

    You’ll want to go here to create a server from the CLI to get started. You’ll be using the PostgreSQL plugin of Swift Kuery, so you will want to make sure that you have PostgreSQL running on your local machine, which you can install with brew install postgresql. The default port for PostgreSQL is 5432.

    +

    Follow Getting Started to create a Kitura server. In this example you’ll be using the Swift Kuery PostgreSQL plugin, so you will need PostgreSQL running on your local machine, which you can install with brew install postgresql. The default port for PostgreSQL is 5432.

    Update your Package.swift file

    -

    Add Swift-Kuery-ORM and Swift-Kuery-PostgreSQL to your Package.swift:

    +

    Add Swift-Kuery-ORM and Swift-Kuery-PostgreSQL to your application’s Package.swift. Substitute "x.x.x" with the latest Swift-Kuery-ORM release and the latest Swift-Kuery-PostgreSQL release.

    dependencies: [
         ...
         // Add these two lines
    -    .package(url: "https://github.com/IBM-Swift/Swift-Kuery-ORM.git", from: "0.0.1"),
    -    .package(url: "https://github.com/IBM-Swift/Swift-Kuery-PostgreSQL.git", from: "1.0.0"),
    +    .package(url: "https://github.com/IBM-Swift/Swift-Kuery-ORM.git", from: "x.x.x"),
    +    .package(url: "https://github.com/IBM-Swift/Swift-Kuery-PostgreSQL.git", from: "x.x.x"),
       ],
       targets: [
         .target(
    @@ -175,14 +201,14 @@ 

    Update your Package.swif ]

    -

    Let’s assume you want to add ORM functionality to a file called Application.swift. You’ll need to make the following import statements at the top of the file:

    +

    Let’s assume you want to add ORM functionality to a file called Application.swift. You’ll need to add the following import statements at the top of the file:

    import SwiftKueryORM
     import SwiftKueryPostgreSQL
     

    Create Your Database

    As mentioned before, we recommend you use Homebrew to set up PostgreSQL on your machine. You can install PostgreSQL and set up your table like so:

    -
    brew install postgresql
    +
    brew install postgresql
     brew services start postgresql
     createdb school
     
    @@ -201,7 +227,7 @@

    Set Up Your Object

    In your Application.swift file, extend Grade to conform to Model

    -
    extension Grade : Model { 
    +
    extension Grade : Model {
         // here, you can add any server-side specific logic to your object
     }
     
    @@ -306,13 +332,19 @@

    Customization

    If you’d like to learn more about how you can customize queries, check out the Swift-Kuery repository for more information.

    -

    List of plugins:

    +

    List of plugins

    +

    API Documentation

    + +

    For more information visit our API reference.

    +

    Community

    + +

    We love to talk server-side Swift, and Kitura. Join our Slack to meet the team!

    License

    This library is licensed under Apache 2.0. Full license text is available in LICENSE.

    @@ -324,7 +356,7 @@

    License

    diff --git a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/search.json b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/search.json index 21cdea4..832748c 100644 --- a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/search.json +++ b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/Documents/search.json @@ -1 +1 @@ -{"Typealiases.html#/s:13SwiftKueryORM21ConnectionPoolOptionsa":{"name":"ConnectionPoolOptions","abstract":"

    Defines the parameters of the ConnectionPool from SwiftKuery

    "},"Typealiases.html#/s:13SwiftKueryORM12RequestErrora":{"name":"RequestError","abstract":"

    Type Alias for RequestError from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM11QueryParamsa":{"name":"QueryParams","abstract":"

    Type Alias for QueryParams from KituraContracts

    "},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP9tableNameSSvZ":{"name":"tableName","abstract":"

    Defines the tableName in the Database

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP12idColumnNameSSvZ":{"name":"idColumnName","abstract":"

    Defines the id column name in the Database

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP12idColumnType0aB007SQLDataG0_pXpvZ":{"name":"idColumnType","abstract":"

    Defines the id column type in the Database

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP15createTableSyncSbAA8DatabaseCSg5using_tKFZ":{"name":"createTableSync(using:)","abstract":"

    Call to create the table in the database synchronously

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP11createTableyAA8DatabaseCSg5using_ySbSg_15KituraContracts12RequestErrorVSgtctFZ":{"name":"createTable(using:_:)","abstract":"

    Call to create the table in the database asynchronously

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP13dropTableSyncSbAA8DatabaseCSg5using_tKFZ":{"name":"dropTableSync(using:)","abstract":"

    Call to drop the table in the database synchronously

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP9dropTableyAA8DatabaseCSg5using_ySbSg_15KituraContracts12RequestErrorVSgtctFZ":{"name":"dropTable(using:_:)","abstract":"

    Call to drop the table in the database asynchronously

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP4saveyAA8DatabaseCSg5using_yxSg_15KituraContracts12RequestErrorVSgtctF":{"name":"save(using:_:)","abstract":"

    Call to save a model to the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP4saveyAA8DatabaseCSg5using_yqd__Sg_xSg15KituraContracts12RequestErrorVSgtctAK10IdentifierRd__lF":{"name":"save(using:_:)","abstract":"

    Call to save a model to the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP4findyqd__2id_AA8DatabaseCSg5usingyxSg_15KituraContracts12RequestErrorVSgtctAK10IdentifierRd__lFZ":{"name":"find(id:using:_:)","abstract":"

    Call to find a model in the database with an id that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_ySayxGSg_15KituraContracts12RequestErrorVSgtctFZ":{"name":"findAll(using:_:)","abstract":"

    Call to find all the models in the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_ySayqd___xtGSg_15KituraContracts12RequestErrorVSgtctAK10IdentifierRd__lFZ":{"name":"findAll(using:_:)","abstract":"

    Call to find all the models in the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_ys10DictionaryVyqd__xGSg_15KituraContracts12RequestErrorVSgtctAM10IdentifierRd__s8HashableRd__lFZ":{"name":"findAll(using:_:)","abstract":"

    Call to find all the models in the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_qd__8matchingySayxGSg_15KituraContracts12RequestErrorVSgtctAL11QueryParamsRd__lFZ":{"name":"findAll(using:matching:_:)","abstract":"

    Call to find all the models in the database matching the QueryParams that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_qd__8matchingySayqd_0__xtGSg_15KituraContracts12RequestErrorVSgtctAL11QueryParamsRd__AL10IdentifierRd_0_r0_lFZ":{"name":"findAll(using:matching:_:)","abstract":"

    Call to find all the models in the database matching the QueryParams that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_qd__8matchingys10DictionaryVyqd_0_xGSg_15KituraContracts12RequestErrorVSgtctAN11QueryParamsRd__AN10IdentifierRd_0_s8HashableRd_0_r0_lFZ":{"name":"findAll(using:matching:_:)","abstract":"

    Call to find all the models in the database matching the QueryParams that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP6updateyqd__2id_AA8DatabaseCSg5usingyxSg_15KituraContracts12RequestErrorVSgtctAK10IdentifierRd__lF":{"name":"update(id:using:_:)","abstract":"

    Call to update a model in the database with an id that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP6deletey15KituraContracts10Identifier_p2id_AA8DatabaseCSg5usingyAE12RequestErrorVSgctFZ":{"name":"delete(id:using:_:)","abstract":"

    Call to delete a model in the database with an id that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP9deleteAllyAA8DatabaseCSg5using_y15KituraContracts12RequestErrorVSgctFZ":{"name":"deleteAll(using:_:)","abstract":"

    Call to delete all the models in the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP9deleteAllyAA8DatabaseCSg5using_qd__8matchingy15KituraContracts12RequestErrorVSgctAJ11QueryParamsRd__lFZ":{"name":"deleteAll(using:matching:_:)","abstract":"

    Call to delete all the models in the database mathcing the QueryParams that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP8getTable0aB00F0CyKFZ":{"name":"getTable()","abstract":"

    Call to get the table of the model

    ","parent_name":"Model"},"Protocols/Model.html":{"name":"Model","abstract":"

    Protocol Model conforming to Codable defining the available operations

    "},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME25ormDatabaseNotInitializedACvZ":{"name":"ormDatabaseNotInitialized","abstract":"

    Error when the Database has not been set

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME016ormTableCreationD0ACvZ":{"name":"ormTableCreationError","abstract":"

    Error when the createTable call fails

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME018ormCodableDecodingD0ACvZ":{"name":"ormCodableDecodingError","abstract":"

    Error when the TypeDecoder failed to extract the types from the model

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME019ormDatabaseDecodingD0ACvZ":{"name":"ormDatabaseDecodingError","abstract":"

    Error when the DatabaseDecoder could not construct a Model

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME019ormDatabaseEncodingD0ACvZ":{"name":"ormDatabaseEncodingError","abstract":"

    Error when the DatabaseEncoder could not decode a Model

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME08ormQueryD0ACvZ":{"name":"ormQueryError","abstract":"

    Error when the Query fails to be executed

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME11ormNotFoundACvZ":{"name":"ormNotFound","abstract":"

    Error when the values retrieved from the database are nil

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME25ormInvalidTableDefinitionACvZ":{"name":"ormInvalidTableDefinition","abstract":"

    Error when the table defined does not contain a specific column

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME013ormIdentifierD0ACvZ":{"name":"ormIdentifierError","abstract":"

    Error when the Identifier could not be constructed

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME011ormInternalD0ACvZ":{"name":"ormInternalError","abstract":"

    Error when an internal error occurs

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME19ormConnectionFailedACvZ":{"name":"ormConnectionFailed","abstract":"

    Error when retrieving a connection from the database fails

    ","parent_name":"RequestError"},"Extensions/RequestError.html":{"name":"RequestError","abstract":"

    Extension of the RequestError from KituraContracts

    "},"Classes/DatabaseEncoder.html#/s:13SwiftKueryORM15DatabaseEncoderC6encodes10DictionaryVySSypGxKs9EncodableRzlF":{"name":"encode(_:)","abstract":"

    Encode a Encodable type to a dictionary [String: Any]

    ","parent_name":"DatabaseEncoder"},"Classes/DatabaseDecoder.html#/s:13SwiftKueryORM15DatabaseDecoderC6decodexxm_s10DictionaryVySSypSgGtKs9DecodableRzlF":{"name":"decode(_:_:)","abstract":"

    Decode from a dictionary [String: Any] to a Decodable type

    ","parent_name":"DatabaseDecoder"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseC7defaultACSgvZ":{"name":"default","abstract":"

    Global default Database for the application

    ","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseC9tableInfoAA05TableF0CvZ":{"name":"tableInfo","abstract":"

    Instance of TableInfo containing cached tables

    ","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseCAC0aB010Connection_p6single_tcfc":{"name":"init(single:)","abstract":"

    Constructor for a single connection which becomes a connection pool

    ","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseCAC0aB014ConnectionPoolCcfc":{"name":"init(_:)","abstract":"

    Default constructor for a connection pool

    ","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseCAC0aB010Connection_pSgyc9generator_tcfc":{"name":"init(generator:)","abstract":"

    Constructor for a custom connection generator

    ","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseC13getConnection0aB00F0_pSgyF":{"name":"getConnection()","abstract":"

    Connection getter: either new connection from pool","parent_name":"Database"},"Classes/Database.html":{"name":"Database","abstract":"

    Class defining the connection to the database.

    "},"Classes/DatabaseDecoder.html":{"name":"DatabaseDecoder","abstract":"

    Class used to construct a Model from a row in the database

    "},"Classes/DatabaseEncoder.html":{"name":"DatabaseEncoder","abstract":"

    Class used to construct a dictionary [String: Any] from a Model

    "},"Classes.html#/s:13SwiftKueryORM9TableInfoC":{"name":"TableInfo","abstract":"

    Class caching the tables for the models of the application

    "},"Classes.html":{"name":"Classes","abstract":"

    The following classes are available globally.

    "},"Extensions.html":{"name":"Extensions","abstract":"

    The following extensions are available globally.

    "},"Protocols.html":{"name":"Protocols","abstract":"

    The following protocols are available globally.

    "},"Typealiases.html":{"name":"Type Aliases","abstract":"

    The following type aliases are available globally.

    "}} \ No newline at end of file +{"Typealiases.html#/s:13SwiftKueryORM21ConnectionPoolOptionsa":{"name":"ConnectionPoolOptions","abstract":"

    Defines the parameters of the ConnectionPool from SwiftKuery

    "},"Typealiases.html#/s:13SwiftKueryORM12RequestErrora":{"name":"RequestError","abstract":"

    Type Alias for RequestError from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM11SQLDataTypea":{"name":"SQLDataType","abstract":"

    Type Alias for SQLDataType from SwiftKuery

    "},"Typealiases.html#/s:13SwiftKueryORM11QueryParamsa":{"name":"QueryParams","abstract":"

    Public TypeAlias for QueryParams Type from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM11GreaterThana":{"name":"GreaterThan","abstract":"

    Public TypeAlias for GreaterThan Type from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM9LowerThana":{"name":"LowerThan","abstract":"

    Public TypeAlias for LowerThan Type from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM18GreaterThanOrEquala":{"name":"GreaterThanOrEqual","abstract":"

    Public TypeAlias for GreaterThanOrEqual Type from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM16LowerThanOrEquala":{"name":"LowerThanOrEqual","abstract":"

    Public TypeAlias for LowerThanOrEqual Type from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM14InclusiveRangea":{"name":"InclusiveRange","abstract":"

    Public TypeAlias for InclusiveRange Type from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM14ExclusiveRangea":{"name":"ExclusiveRange","abstract":"

    Public TypeAlias for ExclusiveRange Type from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM10Paginationa":{"name":"Pagination","abstract":"

    Public TypeAlias for Pagination Type from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM8Orderinga":{"name":"Ordering","abstract":"

    Public TypeAlias for Ordering Type from KituraContracts

    "},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP9tableNameSSvpZ":{"name":"tableName","abstract":"

    Defines the tableName in the Database

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP12idColumnNameSSvpZ":{"name":"idColumnName","abstract":"

    Defines the id column name in the Database

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP12idColumnType0aB007SQLDataG0_pXpvpZ":{"name":"idColumnType","abstract":"

    Defines the id column type in the Database

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP15createTableSyncSbAA8DatabaseCSg5using_tKFZ":{"name":"createTableSync(using:)","abstract":"

    Call to create the table in the database synchronously

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP11createTableyAA8DatabaseCSg5using_ySbSg_15KituraContracts12RequestErrorVSgtctFZ":{"name":"createTable(using:_:)","abstract":"

    Call to create the table in the database asynchronously

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP13dropTableSyncSbAA8DatabaseCSg5using_tKFZ":{"name":"dropTableSync(using:)","abstract":"

    Call to drop the table in the database synchronously

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP9dropTableyAA8DatabaseCSg5using_ySbSg_15KituraContracts12RequestErrorVSgtctFZ":{"name":"dropTable(using:_:)","abstract":"

    Call to drop the table in the database asynchronously

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP4saveyAA8DatabaseCSg5using_yxSg_15KituraContracts12RequestErrorVSgtctF":{"name":"save(using:_:)","abstract":"

    Call to save a model to the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP4saveyAA8DatabaseCSg5using_yqd__Sg_xSg15KituraContracts12RequestErrorVSgtctAK10IdentifierRd__lF":{"name":"save(using:_:)","abstract":"

    Call to save a model to the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP6updateyqd__2id_AA8DatabaseCSg5usingyxSg_15KituraContracts12RequestErrorVSgtctAK10IdentifierRd__lF":{"name":"update(id:using:_:)","abstract":"

    Call to update a model in the database with an id that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP6deletey15KituraContracts10Identifier_p2id_AA8DatabaseCSg5usingyAE12RequestErrorVSgctFZ":{"name":"delete(id:using:_:)","abstract":"

    Call to delete a model in the database with an id that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP9deleteAllyAA8DatabaseCSg5using_y15KituraContracts12RequestErrorVSgctFZ":{"name":"deleteAll(using:_:)","abstract":"

    Call to delete all the models in the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP9deleteAllyAA8DatabaseCSg5using_qd__Sg8matchingy15KituraContracts12RequestErrorVSgctAK11QueryParamsRd__lFZ":{"name":"deleteAll(using:matching:_:)","abstract":"

    Call to delete all the models in the database mathcing the QueryParams that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP8getTable0aB00F0CyKFZ":{"name":"getTable()","abstract":"

    Call to get the table of the model

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP4findyqd__2id_AA8DatabaseCSg5usingyxSg_15KituraContracts12RequestErrorVSgtctAK10IdentifierRd__lFZ":{"name":"find(id:using:_:)","abstract":"

    Call to find a model in the database with an id that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_ySayxGSg_15KituraContracts12RequestErrorVSgtctFZ":{"name":"findAll(using:_:)","abstract":"

    Call to find all the models in the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_ySayqd___xtGSg_15KituraContracts12RequestErrorVSgtctAK10IdentifierRd__lFZ":{"name":"findAll(using:_:)","abstract":"

    Call to find all the models in the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_ys10DictionaryVyqd__xGSg_15KituraContracts12RequestErrorVSgtctAM10IdentifierRd__s8HashableRd__lFZ":{"name":"findAll(using:_:)","abstract":"

    Call to find all the models in the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_qd__Sg8matchingySayxGSg_15KituraContracts12RequestErrorVSgtctAM11QueryParamsRd__lFZ":{"name":"findAll(using:matching:_:)","abstract":"

    Call to find all the models in the database matching the QueryParams that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_qd__Sg8matchingySayqd_0__xtGSg_15KituraContracts12RequestErrorVSgtctAM11QueryParamsRd__AM10IdentifierRd_0_r0_lFZ":{"name":"findAll(using:matching:_:)","abstract":"

    Call to find all the models in the database matching the QueryParams that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_qd__Sg8matchingys10DictionaryVyqd_0_xGSg_15KituraContracts12RequestErrorVSgtctAO11QueryParamsRd__AO10IdentifierRd_0_s8HashableRd_0_r0_lFZ":{"name":"findAll(using:matching:_:)","abstract":"

    Call to find all the models in the database matching the QueryParams that accepts a completion","parent_name":"Model"},"Protocols/Model.html":{"name":"Model","abstract":"

    Protocol Model conforming to Codable defining the available operations

    "},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME25ormDatabaseNotInitializedACvpZ":{"name":"ormDatabaseNotInitialized","abstract":"

    Error when the Database has not been set

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME016ormTableCreationD0ACvpZ":{"name":"ormTableCreationError","abstract":"

    Error when the createTable call fails

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME018ormCodableDecodingD0ACvpZ":{"name":"ormCodableDecodingError","abstract":"

    Error when the TypeDecoder failed to extract the types from the model

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME019ormDatabaseDecodingD0ACvpZ":{"name":"ormDatabaseDecodingError","abstract":"

    Error when the DatabaseDecoder could not construct a Model

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME019ormDatabaseEncodingD0ACvpZ":{"name":"ormDatabaseEncodingError","abstract":"

    Error when the DatabaseEncoder could not decode a Model

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME08ormQueryD0ACvpZ":{"name":"ormQueryError","abstract":"

    Error when the Query fails to be executed

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME11ormNotFoundACvpZ":{"name":"ormNotFound","abstract":"

    Error when the values retrieved from the database are nil

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME25ormInvalidTableDefinitionACvpZ":{"name":"ormInvalidTableDefinition","abstract":"

    Error when the table defined does not contain a specific column

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME013ormIdentifierD0ACvpZ":{"name":"ormIdentifierError","abstract":"

    Error when the Identifier could not be constructed

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME011ormInternalD0ACvpZ":{"name":"ormInternalError","abstract":"

    Error when an internal error occurs

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME19ormConnectionFailedACvpZ":{"name":"ormConnectionFailed","abstract":"

    Error when retrieving a connection from the database fails

    ","parent_name":"RequestError"},"Extensions/RequestError.html":{"name":"RequestError","abstract":"

    Extension of the RequestError from KituraContracts

    "},"Classes/DatabaseEncoder.html#/s:13SwiftKueryORM15DatabaseEncoderC6encodes10DictionaryVySSypGxKs9EncodableRzlF":{"name":"encode(_:)","abstract":"

    Encode a Encodable type to a dictionary [String: Any]

    ","parent_name":"DatabaseEncoder"},"Classes/DatabaseDecoder.html#/s:13SwiftKueryORM15DatabaseDecoderC6decodexxm_s10DictionaryVySSypSgGtKs9DecodableRzlF":{"name":"decode(_:_:)","abstract":"

    Decode from a dictionary [String: Any] to a Decodable type

    ","parent_name":"DatabaseDecoder"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseC0D4Taska":{"name":"DatabaseTask","abstract":"

    Definition of a DatabaseTask completion handler which accepts an optional Connection and optional Error

    ","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseC7defaultACSgvpZ":{"name":"default","abstract":"

    Global default Database for the application

    ","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseC9tableInfoAA05TableF0CvpZ":{"name":"tableInfo","abstract":"

    Instance of TableInfo containing cached tables

    ","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseCAC0aB010Connection_p6single_tcfc":{"name":"init(single:)","abstract":"

    Create a Database instance which uses a single connection to perform each operation. The connection will remain open for the lifetime of the Database.","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseCAC0aB014ConnectionPoolCcfc":{"name":"init(_:)","abstract":"

    Create a Database instance with multiple connections, managed by a connection pool, allowing operations to be performed concurrently. These connections will remain open for the lifetime of the Database.","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseCACyy0aB010Connection_pSg_AD10QueryErrorOSgtcc9generator_tcfc":{"name":"init(generator:)","abstract":"

    Create a Database instance which uses short-lived connections that are generated on demand. A new Connection is created for every operation, and will be closed once the operation completes.","parent_name":"Database"},"Classes/Database.html":{"name":"Database","abstract":"

    Class defining the connection to the database.

    "},"Classes/DatabaseDecoder.html":{"name":"DatabaseDecoder","abstract":"

    Class used to construct a Model from a row in the database

    "},"Classes/DatabaseEncoder.html":{"name":"DatabaseEncoder","abstract":"

    Class used to construct a dictionary [String: Any] from a Model

    "},"Classes.html#/s:13SwiftKueryORM9TableInfoC":{"name":"TableInfo","abstract":"

    Class caching the tables for the models of the application

    "},"Classes.html":{"name":"Classes","abstract":"

    The following classes are available globally.

    "},"Extensions.html":{"name":"Extensions","abstract":"

    The following extensions are available globally.

    "},"Protocols.html":{"name":"Protocols","abstract":"

    The following protocols are available globally.

    "},"Typealiases.html":{"name":"Type Aliases","abstract":"

    The following type aliases are available globally.

    "}} \ No newline at end of file diff --git a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/docSet.dsidx b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/docSet.dsidx index febcd91..67a6502 100644 Binary files a/docs/docsets/SwiftKueryORM.docset/Contents/Resources/docSet.dsidx and b/docs/docsets/SwiftKueryORM.docset/Contents/Resources/docSet.dsidx differ diff --git a/docs/docsets/SwiftKueryORM.tgz b/docs/docsets/SwiftKueryORM.tgz index f0a6415..beb5c95 100644 Binary files a/docs/docsets/SwiftKueryORM.tgz and b/docs/docsets/SwiftKueryORM.tgz differ diff --git a/docs/index.html b/docs/index.html index dec2331..0bff6fd 100644 --- a/docs/index.html +++ b/docs/index.html @@ -88,12 +88,39 @@
  • + + + + + + + + +
  • @@ -110,13 +137,13 @@

    - - Docs + + APIDoc Build Status - Master - Mac OS X + macOS Linux Apache 2 @@ -124,14 +151,13 @@

    Swift-Kuery-ORM

    -

    Summary

    Swift-Kuery-ORM is an ORM (Object Relational Mapping) library built for Swift. Using it allows you to simplify persistence of model objects with your server.

    Swift-Kuery-ORM is built on top of Swift-Kuery, which means that its possible to use Swift-Kuery to customize SQL queries made to the database, if the functionality of the ORM is insufficient.

    The Model Protocol

    -

    The key component of Swift-Kuery-ORM is the protocol Model.

    +

    The key component of Swift-Kuery-ORM is the protocol Model.

    Let’s propose a struct to use as an example. We can declare an object that looks like so:

    struct Grade: Codable {
    @@ -157,15 +183,15 @@ 

    The Model Protocol

    The Model protocol is the key to using the ORM. Let’s walk through how to fully set up an application to make use of the ORM.

    Example

    -

    You’ll want to go here to create a server from the CLI to get started. You’ll be using the PostgreSQL plugin of Swift Kuery, so you will want to make sure that you have PostgreSQL running on your local machine, which you can install with brew install postgresql. The default port for PostgreSQL is 5432.

    +

    Follow Getting Started to create a Kitura server. In this example you’ll be using the Swift Kuery PostgreSQL plugin, so you will need PostgreSQL running on your local machine, which you can install with brew install postgresql. The default port for PostgreSQL is 5432.

    Update your Package.swift file

    -

    Add Swift-Kuery-ORM and Swift-Kuery-PostgreSQL to your Package.swift:

    +

    Add Swift-Kuery-ORM and Swift-Kuery-PostgreSQL to your application’s Package.swift. Substitute "x.x.x" with the latest Swift-Kuery-ORM release and the latest Swift-Kuery-PostgreSQL release.

    dependencies: [
         ...
         // Add these two lines
    -    .package(url: "https://github.com/IBM-Swift/Swift-Kuery-ORM.git", from: "0.0.1"),
    -    .package(url: "https://github.com/IBM-Swift/Swift-Kuery-PostgreSQL.git", from: "1.0.0"),
    +    .package(url: "https://github.com/IBM-Swift/Swift-Kuery-ORM.git", from: "x.x.x"),
    +    .package(url: "https://github.com/IBM-Swift/Swift-Kuery-PostgreSQL.git", from: "x.x.x"),
       ],
       targets: [
         .target(
    @@ -175,14 +201,14 @@ 

    Update your Package.swif ]

    -

    Let’s assume you want to add ORM functionality to a file called Application.swift. You’ll need to make the following import statements at the top of the file:

    +

    Let’s assume you want to add ORM functionality to a file called Application.swift. You’ll need to add the following import statements at the top of the file:

    import SwiftKueryORM
     import SwiftKueryPostgreSQL
     

    Create Your Database

    As mentioned before, we recommend you use Homebrew to set up PostgreSQL on your machine. You can install PostgreSQL and set up your table like so:

    -
    brew install postgresql
    +
    brew install postgresql
     brew services start postgresql
     createdb school
     
    @@ -201,7 +227,7 @@

    Set Up Your Object

    In your Application.swift file, extend Grade to conform to Model

    -
    extension Grade : Model { 
    +
    extension Grade : Model {
         // here, you can add any server-side specific logic to your object
     }
     
    @@ -306,13 +332,19 @@

    Customization

    If you’d like to learn more about how you can customize queries, check out the Swift-Kuery repository for more information.

    -

    List of plugins:

    +

    List of plugins

    +

    API Documentation

    + +

    For more information visit our API reference.

    +

    Community

    + +

    We love to talk server-side Swift, and Kitura. Join our Slack to meet the team!

    License

    This library is licensed under Apache 2.0. Full license text is available in LICENSE.

    @@ -324,7 +356,7 @@

    License

    diff --git a/docs/search.json b/docs/search.json index 21cdea4..832748c 100644 --- a/docs/search.json +++ b/docs/search.json @@ -1 +1 @@ -{"Typealiases.html#/s:13SwiftKueryORM21ConnectionPoolOptionsa":{"name":"ConnectionPoolOptions","abstract":"

    Defines the parameters of the ConnectionPool from SwiftKuery

    "},"Typealiases.html#/s:13SwiftKueryORM12RequestErrora":{"name":"RequestError","abstract":"

    Type Alias for RequestError from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM11QueryParamsa":{"name":"QueryParams","abstract":"

    Type Alias for QueryParams from KituraContracts

    "},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP9tableNameSSvZ":{"name":"tableName","abstract":"

    Defines the tableName in the Database

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP12idColumnNameSSvZ":{"name":"idColumnName","abstract":"

    Defines the id column name in the Database

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP12idColumnType0aB007SQLDataG0_pXpvZ":{"name":"idColumnType","abstract":"

    Defines the id column type in the Database

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP15createTableSyncSbAA8DatabaseCSg5using_tKFZ":{"name":"createTableSync(using:)","abstract":"

    Call to create the table in the database synchronously

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP11createTableyAA8DatabaseCSg5using_ySbSg_15KituraContracts12RequestErrorVSgtctFZ":{"name":"createTable(using:_:)","abstract":"

    Call to create the table in the database asynchronously

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP13dropTableSyncSbAA8DatabaseCSg5using_tKFZ":{"name":"dropTableSync(using:)","abstract":"

    Call to drop the table in the database synchronously

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP9dropTableyAA8DatabaseCSg5using_ySbSg_15KituraContracts12RequestErrorVSgtctFZ":{"name":"dropTable(using:_:)","abstract":"

    Call to drop the table in the database asynchronously

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP4saveyAA8DatabaseCSg5using_yxSg_15KituraContracts12RequestErrorVSgtctF":{"name":"save(using:_:)","abstract":"

    Call to save a model to the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP4saveyAA8DatabaseCSg5using_yqd__Sg_xSg15KituraContracts12RequestErrorVSgtctAK10IdentifierRd__lF":{"name":"save(using:_:)","abstract":"

    Call to save a model to the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP4findyqd__2id_AA8DatabaseCSg5usingyxSg_15KituraContracts12RequestErrorVSgtctAK10IdentifierRd__lFZ":{"name":"find(id:using:_:)","abstract":"

    Call to find a model in the database with an id that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_ySayxGSg_15KituraContracts12RequestErrorVSgtctFZ":{"name":"findAll(using:_:)","abstract":"

    Call to find all the models in the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_ySayqd___xtGSg_15KituraContracts12RequestErrorVSgtctAK10IdentifierRd__lFZ":{"name":"findAll(using:_:)","abstract":"

    Call to find all the models in the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_ys10DictionaryVyqd__xGSg_15KituraContracts12RequestErrorVSgtctAM10IdentifierRd__s8HashableRd__lFZ":{"name":"findAll(using:_:)","abstract":"

    Call to find all the models in the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_qd__8matchingySayxGSg_15KituraContracts12RequestErrorVSgtctAL11QueryParamsRd__lFZ":{"name":"findAll(using:matching:_:)","abstract":"

    Call to find all the models in the database matching the QueryParams that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_qd__8matchingySayqd_0__xtGSg_15KituraContracts12RequestErrorVSgtctAL11QueryParamsRd__AL10IdentifierRd_0_r0_lFZ":{"name":"findAll(using:matching:_:)","abstract":"

    Call to find all the models in the database matching the QueryParams that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_qd__8matchingys10DictionaryVyqd_0_xGSg_15KituraContracts12RequestErrorVSgtctAN11QueryParamsRd__AN10IdentifierRd_0_s8HashableRd_0_r0_lFZ":{"name":"findAll(using:matching:_:)","abstract":"

    Call to find all the models in the database matching the QueryParams that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP6updateyqd__2id_AA8DatabaseCSg5usingyxSg_15KituraContracts12RequestErrorVSgtctAK10IdentifierRd__lF":{"name":"update(id:using:_:)","abstract":"

    Call to update a model in the database with an id that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP6deletey15KituraContracts10Identifier_p2id_AA8DatabaseCSg5usingyAE12RequestErrorVSgctFZ":{"name":"delete(id:using:_:)","abstract":"

    Call to delete a model in the database with an id that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP9deleteAllyAA8DatabaseCSg5using_y15KituraContracts12RequestErrorVSgctFZ":{"name":"deleteAll(using:_:)","abstract":"

    Call to delete all the models in the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP9deleteAllyAA8DatabaseCSg5using_qd__8matchingy15KituraContracts12RequestErrorVSgctAJ11QueryParamsRd__lFZ":{"name":"deleteAll(using:matching:_:)","abstract":"

    Call to delete all the models in the database mathcing the QueryParams that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP8getTable0aB00F0CyKFZ":{"name":"getTable()","abstract":"

    Call to get the table of the model

    ","parent_name":"Model"},"Protocols/Model.html":{"name":"Model","abstract":"

    Protocol Model conforming to Codable defining the available operations

    "},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME25ormDatabaseNotInitializedACvZ":{"name":"ormDatabaseNotInitialized","abstract":"

    Error when the Database has not been set

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME016ormTableCreationD0ACvZ":{"name":"ormTableCreationError","abstract":"

    Error when the createTable call fails

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME018ormCodableDecodingD0ACvZ":{"name":"ormCodableDecodingError","abstract":"

    Error when the TypeDecoder failed to extract the types from the model

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME019ormDatabaseDecodingD0ACvZ":{"name":"ormDatabaseDecodingError","abstract":"

    Error when the DatabaseDecoder could not construct a Model

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME019ormDatabaseEncodingD0ACvZ":{"name":"ormDatabaseEncodingError","abstract":"

    Error when the DatabaseEncoder could not decode a Model

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME08ormQueryD0ACvZ":{"name":"ormQueryError","abstract":"

    Error when the Query fails to be executed

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME11ormNotFoundACvZ":{"name":"ormNotFound","abstract":"

    Error when the values retrieved from the database are nil

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME25ormInvalidTableDefinitionACvZ":{"name":"ormInvalidTableDefinition","abstract":"

    Error when the table defined does not contain a specific column

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME013ormIdentifierD0ACvZ":{"name":"ormIdentifierError","abstract":"

    Error when the Identifier could not be constructed

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME011ormInternalD0ACvZ":{"name":"ormInternalError","abstract":"

    Error when an internal error occurs

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME19ormConnectionFailedACvZ":{"name":"ormConnectionFailed","abstract":"

    Error when retrieving a connection from the database fails

    ","parent_name":"RequestError"},"Extensions/RequestError.html":{"name":"RequestError","abstract":"

    Extension of the RequestError from KituraContracts

    "},"Classes/DatabaseEncoder.html#/s:13SwiftKueryORM15DatabaseEncoderC6encodes10DictionaryVySSypGxKs9EncodableRzlF":{"name":"encode(_:)","abstract":"

    Encode a Encodable type to a dictionary [String: Any]

    ","parent_name":"DatabaseEncoder"},"Classes/DatabaseDecoder.html#/s:13SwiftKueryORM15DatabaseDecoderC6decodexxm_s10DictionaryVySSypSgGtKs9DecodableRzlF":{"name":"decode(_:_:)","abstract":"

    Decode from a dictionary [String: Any] to a Decodable type

    ","parent_name":"DatabaseDecoder"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseC7defaultACSgvZ":{"name":"default","abstract":"

    Global default Database for the application

    ","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseC9tableInfoAA05TableF0CvZ":{"name":"tableInfo","abstract":"

    Instance of TableInfo containing cached tables

    ","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseCAC0aB010Connection_p6single_tcfc":{"name":"init(single:)","abstract":"

    Constructor for a single connection which becomes a connection pool

    ","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseCAC0aB014ConnectionPoolCcfc":{"name":"init(_:)","abstract":"

    Default constructor for a connection pool

    ","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseCAC0aB010Connection_pSgyc9generator_tcfc":{"name":"init(generator:)","abstract":"

    Constructor for a custom connection generator

    ","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseC13getConnection0aB00F0_pSgyF":{"name":"getConnection()","abstract":"

    Connection getter: either new connection from pool","parent_name":"Database"},"Classes/Database.html":{"name":"Database","abstract":"

    Class defining the connection to the database.

    "},"Classes/DatabaseDecoder.html":{"name":"DatabaseDecoder","abstract":"

    Class used to construct a Model from a row in the database

    "},"Classes/DatabaseEncoder.html":{"name":"DatabaseEncoder","abstract":"

    Class used to construct a dictionary [String: Any] from a Model

    "},"Classes.html#/s:13SwiftKueryORM9TableInfoC":{"name":"TableInfo","abstract":"

    Class caching the tables for the models of the application

    "},"Classes.html":{"name":"Classes","abstract":"

    The following classes are available globally.

    "},"Extensions.html":{"name":"Extensions","abstract":"

    The following extensions are available globally.

    "},"Protocols.html":{"name":"Protocols","abstract":"

    The following protocols are available globally.

    "},"Typealiases.html":{"name":"Type Aliases","abstract":"

    The following type aliases are available globally.

    "}} \ No newline at end of file +{"Typealiases.html#/s:13SwiftKueryORM21ConnectionPoolOptionsa":{"name":"ConnectionPoolOptions","abstract":"

    Defines the parameters of the ConnectionPool from SwiftKuery

    "},"Typealiases.html#/s:13SwiftKueryORM12RequestErrora":{"name":"RequestError","abstract":"

    Type Alias for RequestError from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM11SQLDataTypea":{"name":"SQLDataType","abstract":"

    Type Alias for SQLDataType from SwiftKuery

    "},"Typealiases.html#/s:13SwiftKueryORM11QueryParamsa":{"name":"QueryParams","abstract":"

    Public TypeAlias for QueryParams Type from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM11GreaterThana":{"name":"GreaterThan","abstract":"

    Public TypeAlias for GreaterThan Type from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM9LowerThana":{"name":"LowerThan","abstract":"

    Public TypeAlias for LowerThan Type from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM18GreaterThanOrEquala":{"name":"GreaterThanOrEqual","abstract":"

    Public TypeAlias for GreaterThanOrEqual Type from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM16LowerThanOrEquala":{"name":"LowerThanOrEqual","abstract":"

    Public TypeAlias for LowerThanOrEqual Type from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM14InclusiveRangea":{"name":"InclusiveRange","abstract":"

    Public TypeAlias for InclusiveRange Type from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM14ExclusiveRangea":{"name":"ExclusiveRange","abstract":"

    Public TypeAlias for ExclusiveRange Type from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM10Paginationa":{"name":"Pagination","abstract":"

    Public TypeAlias for Pagination Type from KituraContracts

    "},"Typealiases.html#/s:13SwiftKueryORM8Orderinga":{"name":"Ordering","abstract":"

    Public TypeAlias for Ordering Type from KituraContracts

    "},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP9tableNameSSvpZ":{"name":"tableName","abstract":"

    Defines the tableName in the Database

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP12idColumnNameSSvpZ":{"name":"idColumnName","abstract":"

    Defines the id column name in the Database

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP12idColumnType0aB007SQLDataG0_pXpvpZ":{"name":"idColumnType","abstract":"

    Defines the id column type in the Database

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP15createTableSyncSbAA8DatabaseCSg5using_tKFZ":{"name":"createTableSync(using:)","abstract":"

    Call to create the table in the database synchronously

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP11createTableyAA8DatabaseCSg5using_ySbSg_15KituraContracts12RequestErrorVSgtctFZ":{"name":"createTable(using:_:)","abstract":"

    Call to create the table in the database asynchronously

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP13dropTableSyncSbAA8DatabaseCSg5using_tKFZ":{"name":"dropTableSync(using:)","abstract":"

    Call to drop the table in the database synchronously

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP9dropTableyAA8DatabaseCSg5using_ySbSg_15KituraContracts12RequestErrorVSgtctFZ":{"name":"dropTable(using:_:)","abstract":"

    Call to drop the table in the database asynchronously

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP4saveyAA8DatabaseCSg5using_yxSg_15KituraContracts12RequestErrorVSgtctF":{"name":"save(using:_:)","abstract":"

    Call to save a model to the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP4saveyAA8DatabaseCSg5using_yqd__Sg_xSg15KituraContracts12RequestErrorVSgtctAK10IdentifierRd__lF":{"name":"save(using:_:)","abstract":"

    Call to save a model to the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP6updateyqd__2id_AA8DatabaseCSg5usingyxSg_15KituraContracts12RequestErrorVSgtctAK10IdentifierRd__lF":{"name":"update(id:using:_:)","abstract":"

    Call to update a model in the database with an id that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP6deletey15KituraContracts10Identifier_p2id_AA8DatabaseCSg5usingyAE12RequestErrorVSgctFZ":{"name":"delete(id:using:_:)","abstract":"

    Call to delete a model in the database with an id that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP9deleteAllyAA8DatabaseCSg5using_y15KituraContracts12RequestErrorVSgctFZ":{"name":"deleteAll(using:_:)","abstract":"

    Call to delete all the models in the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP9deleteAllyAA8DatabaseCSg5using_qd__Sg8matchingy15KituraContracts12RequestErrorVSgctAK11QueryParamsRd__lFZ":{"name":"deleteAll(using:matching:_:)","abstract":"

    Call to delete all the models in the database mathcing the QueryParams that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP8getTable0aB00F0CyKFZ":{"name":"getTable()","abstract":"

    Call to get the table of the model

    ","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP4findyqd__2id_AA8DatabaseCSg5usingyxSg_15KituraContracts12RequestErrorVSgtctAK10IdentifierRd__lFZ":{"name":"find(id:using:_:)","abstract":"

    Call to find a model in the database with an id that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_ySayxGSg_15KituraContracts12RequestErrorVSgtctFZ":{"name":"findAll(using:_:)","abstract":"

    Call to find all the models in the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_ySayqd___xtGSg_15KituraContracts12RequestErrorVSgtctAK10IdentifierRd__lFZ":{"name":"findAll(using:_:)","abstract":"

    Call to find all the models in the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_ys10DictionaryVyqd__xGSg_15KituraContracts12RequestErrorVSgtctAM10IdentifierRd__s8HashableRd__lFZ":{"name":"findAll(using:_:)","abstract":"

    Call to find all the models in the database that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_qd__Sg8matchingySayxGSg_15KituraContracts12RequestErrorVSgtctAM11QueryParamsRd__lFZ":{"name":"findAll(using:matching:_:)","abstract":"

    Call to find all the models in the database matching the QueryParams that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_qd__Sg8matchingySayqd_0__xtGSg_15KituraContracts12RequestErrorVSgtctAM11QueryParamsRd__AM10IdentifierRd_0_r0_lFZ":{"name":"findAll(using:matching:_:)","abstract":"

    Call to find all the models in the database matching the QueryParams that accepts a completion","parent_name":"Model"},"Protocols/Model.html#/s:13SwiftKueryORM5ModelP7findAllyAA8DatabaseCSg5using_qd__Sg8matchingys10DictionaryVyqd_0_xGSg_15KituraContracts12RequestErrorVSgtctAO11QueryParamsRd__AO10IdentifierRd_0_s8HashableRd_0_r0_lFZ":{"name":"findAll(using:matching:_:)","abstract":"

    Call to find all the models in the database matching the QueryParams that accepts a completion","parent_name":"Model"},"Protocols/Model.html":{"name":"Model","abstract":"

    Protocol Model conforming to Codable defining the available operations

    "},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME25ormDatabaseNotInitializedACvpZ":{"name":"ormDatabaseNotInitialized","abstract":"

    Error when the Database has not been set

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME016ormTableCreationD0ACvpZ":{"name":"ormTableCreationError","abstract":"

    Error when the createTable call fails

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME018ormCodableDecodingD0ACvpZ":{"name":"ormCodableDecodingError","abstract":"

    Error when the TypeDecoder failed to extract the types from the model

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME019ormDatabaseDecodingD0ACvpZ":{"name":"ormDatabaseDecodingError","abstract":"

    Error when the DatabaseDecoder could not construct a Model

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME019ormDatabaseEncodingD0ACvpZ":{"name":"ormDatabaseEncodingError","abstract":"

    Error when the DatabaseEncoder could not decode a Model

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME08ormQueryD0ACvpZ":{"name":"ormQueryError","abstract":"

    Error when the Query fails to be executed

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME11ormNotFoundACvpZ":{"name":"ormNotFound","abstract":"

    Error when the values retrieved from the database are nil

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME25ormInvalidTableDefinitionACvpZ":{"name":"ormInvalidTableDefinition","abstract":"

    Error when the table defined does not contain a specific column

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME013ormIdentifierD0ACvpZ":{"name":"ormIdentifierError","abstract":"

    Error when the Identifier could not be constructed

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME011ormInternalD0ACvpZ":{"name":"ormInternalError","abstract":"

    Error when an internal error occurs

    ","parent_name":"RequestError"},"Extensions/RequestError.html#/s:15KituraContracts12RequestErrorV13SwiftKueryORME19ormConnectionFailedACvpZ":{"name":"ormConnectionFailed","abstract":"

    Error when retrieving a connection from the database fails

    ","parent_name":"RequestError"},"Extensions/RequestError.html":{"name":"RequestError","abstract":"

    Extension of the RequestError from KituraContracts

    "},"Classes/DatabaseEncoder.html#/s:13SwiftKueryORM15DatabaseEncoderC6encodes10DictionaryVySSypGxKs9EncodableRzlF":{"name":"encode(_:)","abstract":"

    Encode a Encodable type to a dictionary [String: Any]

    ","parent_name":"DatabaseEncoder"},"Classes/DatabaseDecoder.html#/s:13SwiftKueryORM15DatabaseDecoderC6decodexxm_s10DictionaryVySSypSgGtKs9DecodableRzlF":{"name":"decode(_:_:)","abstract":"

    Decode from a dictionary [String: Any] to a Decodable type

    ","parent_name":"DatabaseDecoder"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseC0D4Taska":{"name":"DatabaseTask","abstract":"

    Definition of a DatabaseTask completion handler which accepts an optional Connection and optional Error

    ","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseC7defaultACSgvpZ":{"name":"default","abstract":"

    Global default Database for the application

    ","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseC9tableInfoAA05TableF0CvpZ":{"name":"tableInfo","abstract":"

    Instance of TableInfo containing cached tables

    ","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseCAC0aB010Connection_p6single_tcfc":{"name":"init(single:)","abstract":"

    Create a Database instance which uses a single connection to perform each operation. The connection will remain open for the lifetime of the Database.","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseCAC0aB014ConnectionPoolCcfc":{"name":"init(_:)","abstract":"

    Create a Database instance with multiple connections, managed by a connection pool, allowing operations to be performed concurrently. These connections will remain open for the lifetime of the Database.","parent_name":"Database"},"Classes/Database.html#/s:13SwiftKueryORM8DatabaseCACyy0aB010Connection_pSg_AD10QueryErrorOSgtcc9generator_tcfc":{"name":"init(generator:)","abstract":"

    Create a Database instance which uses short-lived connections that are generated on demand. A new Connection is created for every operation, and will be closed once the operation completes.","parent_name":"Database"},"Classes/Database.html":{"name":"Database","abstract":"

    Class defining the connection to the database.

    "},"Classes/DatabaseDecoder.html":{"name":"DatabaseDecoder","abstract":"

    Class used to construct a Model from a row in the database

    "},"Classes/DatabaseEncoder.html":{"name":"DatabaseEncoder","abstract":"

    Class used to construct a dictionary [String: Any] from a Model

    "},"Classes.html#/s:13SwiftKueryORM9TableInfoC":{"name":"TableInfo","abstract":"

    Class caching the tables for the models of the application

    "},"Classes.html":{"name":"Classes","abstract":"

    The following classes are available globally.

    "},"Extensions.html":{"name":"Extensions","abstract":"

    The following extensions are available globally.

    "},"Protocols.html":{"name":"Protocols","abstract":"

    The following protocols are available globally.

    "},"Typealiases.html":{"name":"Type Aliases","abstract":"

    The following type aliases are available globally.

    "}} \ No newline at end of file diff --git a/docs/undocumented.json b/docs/undocumented.json index b6ca435..74a3ab2 100644 --- a/docs/undocumented.json +++ b/docs/undocumented.json @@ -2,14 +2,14 @@ "warnings": [ { "file": "/Users/travis/build/IBM-Swift/Swift-Kuery-ORM/Sources/SwiftKueryORM/Model.swift", - "line": 241, + "line": 223, "symbol": "Model.save(using:_:)", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented" }, { "file": "/Users/travis/build/IBM-Swift/Swift-Kuery-ORM/Sources/SwiftKueryORM/Model.swift", - "line": 291, + "line": 241, "symbol": "Model.save(using:_:)", "symbol_kind": "source.lang.swift.decl.function.method.instance", "warning": "undocumented"