From 877ff1f58671b1c0fbc6e1dd12f0ceb955755fc9 Mon Sep 17 00:00:00 2001 From: kilnerm <38245247+kilnerm@users.noreply.github.com> Date: Tue, 17 Apr 2018 11:36:37 +0100 Subject: [PATCH] Add UUID type --- Sources/SwiftKuery/QueryBuilder.swift | 3 + Sources/SwiftKuery/SQLDataType.swift | 12 + docs/Classes.html | 5 +- docs/Classes/AuxiliaryTable.html | 5 +- docs/Classes/Column.html | 5 +- docs/Classes/ConnectionPool.html | 5 +- docs/Classes/ConnectionPoolConnection.html | 5 +- docs/Classes/Migration.html | 5 +- docs/Classes/QueryBuilder.html | 5 +- .../QueryBuilder/QuerySubstitutionNames.html | 36 +- docs/Classes/Table.html | 5 +- docs/Enums.html | 5 +- docs/Enums/Condition.html | 5 +- docs/Enums/IndexColumnOrdered.html | 5 +- docs/Enums/Join.html | 5 +- docs/Enums/OrderBy.html | 5 +- docs/Enums/Predicate.html | 5 +- docs/Enums/QueryError.html | 5 +- docs/Enums/QueryResult.html | 5 +- docs/Enums/Union.html | 5 +- docs/Extensions.html | 32 +- docs/Extensions/Bool.html | 5 +- docs/Extensions/Date.html | 5 +- docs/Extensions/Double.html | 5 +- docs/Extensions/Float.html | 5 +- docs/Extensions/Int.html | 5 +- docs/Extensions/Int16.html | 5 +- docs/Extensions/Int32.html | 5 +- docs/Extensions/Int64.html | 5 +- docs/Extensions/String.html | 5 +- docs/Extensions/UUID.html | 2081 +++++++++++++++++ docs/Functions.html | 5 +- docs/Protocols.html | 5 +- docs/Protocols/Buildable.html | 5 +- docs/Protocols/ConditionalClause.html | 5 +- docs/Protocols/Connection.html | 5 +- docs/Protocols/Field.html | 5 +- docs/Protocols/IndexColumn.html | 5 +- docs/Protocols/Query.html | 5 +- docs/Protocols/ResultFetcher.html | 5 +- docs/Protocols/SQLDataType.html | 5 +- docs/Structs.html | 5 +- docs/Structs/AggregateColumnExpression.html | 5 +- .../AggregateFunction.html | 5 +- docs/Structs/Char.html | 5 +- docs/Structs/ConnectionPoolOptions.html | 5 +- docs/Structs/Delete.html | 5 +- docs/Structs/Filter.html | 5 +- docs/Structs/Having.html | 5 +- docs/Structs/Index.html | 5 +- docs/Structs/Insert.html | 5 +- docs/Structs/Parameter.html | 5 +- docs/Structs/Raw.html | 5 +- docs/Structs/RawField.html | 5 +- docs/Structs/ResultSet.html | 5 +- docs/Structs/RowSequence.html | 5 +- docs/Structs/SQLDate.html | 5 +- docs/Structs/ScalarColumnExpression.html | 5 +- .../ScalarFunction.html | 5 +- docs/Structs/Select.html | 5 +- docs/Structs/Time.html | 5 +- docs/Structs/Timestamp.html | 5 +- docs/Structs/Update.html | 5 +- docs/Structs/Varchar.html | 5 +- .../Contents/Resources/Documents/Classes.html | 5 +- .../Documents/Classes/AuxiliaryTable.html | 5 +- .../Resources/Documents/Classes/Column.html | 5 +- .../Documents/Classes/ConnectionPool.html | 5 +- .../Classes/ConnectionPoolConnection.html | 5 +- .../Documents/Classes/Migration.html | 5 +- .../Documents/Classes/QueryBuilder.html | 5 +- .../QueryBuilder/QuerySubstitutionNames.html | 36 +- .../Resources/Documents/Classes/Table.html | 5 +- .../Contents/Resources/Documents/Enums.html | 5 +- .../Resources/Documents/Enums/Condition.html | 5 +- .../Documents/Enums/IndexColumnOrdered.html | 5 +- .../Resources/Documents/Enums/Join.html | 5 +- .../Resources/Documents/Enums/OrderBy.html | 5 +- .../Resources/Documents/Enums/Predicate.html | 5 +- .../Resources/Documents/Enums/QueryError.html | 5 +- .../Documents/Enums/QueryResult.html | 5 +- .../Resources/Documents/Enums/Union.html | 5 +- .../Resources/Documents/Extensions.html | 32 +- .../Resources/Documents/Extensions/Bool.html | 5 +- .../Resources/Documents/Extensions/Date.html | 5 +- .../Documents/Extensions/Double.html | 5 +- .../Resources/Documents/Extensions/Float.html | 5 +- .../Resources/Documents/Extensions/Int.html | 5 +- .../Resources/Documents/Extensions/Int16.html | 5 +- .../Resources/Documents/Extensions/Int32.html | 5 +- .../Resources/Documents/Extensions/Int64.html | 5 +- .../Documents/Extensions/String.html | 5 +- .../Resources/Documents/Extensions/UUID.html | 2081 +++++++++++++++++ .../Resources/Documents/Functions.html | 5 +- .../Resources/Documents/Protocols.html | 5 +- .../Documents/Protocols/Buildable.html | 5 +- .../Protocols/ConditionalClause.html | 5 +- .../Documents/Protocols/Connection.html | 5 +- .../Resources/Documents/Protocols/Field.html | 5 +- .../Documents/Protocols/IndexColumn.html | 5 +- .../Resources/Documents/Protocols/Query.html | 5 +- .../Documents/Protocols/ResultFetcher.html | 5 +- .../Documents/Protocols/SQLDataType.html | 5 +- .../Contents/Resources/Documents/Structs.html | 5 +- .../Structs/AggregateColumnExpression.html | 5 +- .../AggregateFunction.html | 5 +- .../Resources/Documents/Structs/Char.html | 5 +- .../Structs/ConnectionPoolOptions.html | 5 +- .../Resources/Documents/Structs/Delete.html | 5 +- .../Resources/Documents/Structs/Filter.html | 5 +- .../Resources/Documents/Structs/Having.html | 5 +- .../Resources/Documents/Structs/Index.html | 5 +- .../Resources/Documents/Structs/Insert.html | 5 +- .../Documents/Structs/Parameter.html | 5 +- .../Resources/Documents/Structs/Raw.html | 5 +- .../Resources/Documents/Structs/RawField.html | 5 +- .../Documents/Structs/ResultSet.html | 5 +- .../Documents/Structs/RowSequence.html | 5 +- .../Resources/Documents/Structs/SQLDate.html | 5 +- .../Structs/ScalarColumnExpression.html | 5 +- .../ScalarFunction.html | 5 +- .../Resources/Documents/Structs/Select.html | 5 +- .../Resources/Documents/Structs/Time.html | 5 +- .../Documents/Structs/Timestamp.html | 5 +- .../Resources/Documents/Structs/Update.html | 5 +- .../Resources/Documents/Structs/Varchar.html | 5 +- .../Contents/Resources/Documents/index.html | 32 +- .../Contents/Resources/Documents/search.json | 2 +- .../Contents/Resources/docSet.dsidx | Bin 352256 -> 352256 bytes docs/docsets/SwiftKuery.tgz | Bin 540334 -> 546540 bytes docs/index.html | 32 +- docs/search.json | 2 +- 132 files changed, 4833 insertions(+), 138 deletions(-) create mode 100644 docs/Extensions/UUID.html create mode 100644 docs/docsets/SwiftKuery.docset/Contents/Resources/Documents/Extensions/UUID.html diff --git a/Sources/SwiftKuery/QueryBuilder.swift b/Sources/SwiftKuery/QueryBuilder.swift index ce974570..ca6b0438 100644 --- a/Sources/SwiftKuery/QueryBuilder.swift +++ b/Sources/SwiftKuery/QueryBuilder.swift @@ -57,6 +57,8 @@ public class QueryBuilder { case double /// The database type that corresponds to char. case char + /// The database type that corresponds to UUID. Accepts a string representation of UUID. + case uuid /// Last case, add new values before it. case namesCount @@ -115,6 +117,7 @@ public class QueryBuilder { substitutions[QuerySubstitutionNames.float.rawValue] = "real" substitutions[QuerySubstitutionNames.double.rawValue] = "double" substitutions[QuerySubstitutionNames.char.rawValue] = "char" + substitutions[QuerySubstitutionNames.uuid.rawValue] = "varchar(36)" self.addNumbersToParameters = addNumbersToParameters self.anyOnSubquerySupported = anyOnSubquerySupported diff --git a/Sources/SwiftKuery/SQLDataType.swift b/Sources/SwiftKuery/SQLDataType.swift index f406266f..1a235b57 100644 --- a/Sources/SwiftKuery/SQLDataType.swift +++ b/Sources/SwiftKuery/SQLDataType.swift @@ -14,6 +14,8 @@ limitations under the License. */ +import Foundation + // MARK: SQLDataType protocol /// Defines the protocol for data types to be used as table column types. @@ -150,5 +152,15 @@ extension Bool: SQLDataType { } } +extension UUID: SQLDataType { + /// Return database specific representation of the UUID type using `QueryBuilder`. + /// + /// - Parameter queryBuilder: The QueryBuilder to use. + /// - Returns: A String representation of the type. + public static func create(queryBuilder: QueryBuilder) -> String { + return queryBuilder.substitutions[QueryBuilder.QuerySubstitutionNames.uuid.rawValue] + } +} + diff --git a/docs/Classes.html b/docs/Classes.html index 2cabaea1..75df5a5f 100644 --- a/docs/Classes.html +++ b/docs/Classes.html @@ -137,6 +137,9 @@ + + + + + + + + +
+ +
diff --git a/docs/Classes/Table.html b/docs/Classes/Table.html index ffba5718..fe3faf6c 100644 --- a/docs/Classes/Table.html +++ b/docs/Classes/Table.html @@ -138,6 +138,9 @@ + + + + + + + + + + + +
  • +
    + + + + UUID + +
    +
    +
    +
    +
    +
    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    struct UUID : ReferenceConvertible, Hashable, Equatable, CustomStringConvertible
    + +
    +
    +
    +
    +
  • @@ -2268,7 +2298,7 @@

    Declaration

    diff --git a/docs/Extensions/Bool.html b/docs/Extensions/Bool.html index 0e2d7c02..caf6937e 100644 --- a/docs/Extensions/Bool.html +++ b/docs/Extensions/Bool.html @@ -138,6 +138,9 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    diff --git a/docs/docsets/SwiftKuery.docset/Contents/Resources/Documents/Classes/Table.html b/docs/docsets/SwiftKuery.docset/Contents/Resources/Documents/Classes/Table.html index ffba5718..fe3faf6c 100644 --- a/docs/docsets/SwiftKuery.docset/Contents/Resources/Documents/Classes/Table.html +++ b/docs/docsets/SwiftKuery.docset/Contents/Resources/Documents/Classes/Table.html @@ -138,6 +138,9 @@ + + + + + + + + + + + +
  • +
    + + + + UUID + +
    +
    +
    +
    +
    +
    + + See more +
    +
    +

    Declaration

    +
    +

    Swift

    +
    struct UUID : ReferenceConvertible, Hashable, Equatable, CustomStringConvertible
    + +
    +
    +
    +
    +
  • @@ -2268,7 +2298,7 @@

    Declaration

    diff --git a/docs/docsets/SwiftKuery.docset/Contents/Resources/Documents/Extensions/Bool.html b/docs/docsets/SwiftKuery.docset/Contents/Resources/Documents/Extensions/Bool.html index 0e2d7c02..caf6937e 100644 --- a/docs/docsets/SwiftKuery.docset/Contents/Resources/Documents/Extensions/Bool.html +++ b/docs/docsets/SwiftKuery.docset/Contents/Resources/Documents/Extensions/Bool.html @@ -138,6 +138,9 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +