mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-24 04:07:47 +00:00
Remove some obsolete & unused code
This commit is contained in:
1 parent
ae3a0490ee
commit
a9ea939968
1 file changed
+4
-24
+4
-24
@@ -187,37 +187,19 @@ public struct Bindings {
|
||||
impl.bindInStatement(statement)
|
||||
}
|
||||
|
||||
// Supported usage: loading of RowModel by multiple-columns primary keys:
|
||||
//
|
||||
// let person = db.fetchOne(Person.self, primaryKey: Bindings)
|
||||
func dictionary(defaultColumnNames defaultColumnNames: [String]?) -> [String: DatabaseValueConvertible?] {
|
||||
return impl.dictionary(defaultColumnNames: defaultColumnNames)
|
||||
}
|
||||
|
||||
// Support for array-based bindings
|
||||
private struct BindingsArrayImpl : BindingsImpl {
|
||||
let values: [DatabaseValueConvertible?]
|
||||
|
||||
init(values: [DatabaseValueConvertible?]) {
|
||||
self.values = values
|
||||
}
|
||||
|
||||
func bindInStatement(statement: Statement) {
|
||||
for (index, value) in values.enumerate() {
|
||||
statement.bind(value, atIndex: index + 1)
|
||||
}
|
||||
}
|
||||
func dictionary(defaultColumnNames defaultColumnNames: [String]?) -> [String : DatabaseValueConvertible?] {
|
||||
guard let defaultColumnNames = defaultColumnNames else {
|
||||
fatalError("Missing column names")
|
||||
}
|
||||
guard defaultColumnNames.count == values.count else {
|
||||
fatalError("Columns count mismatch.")
|
||||
}
|
||||
var dictionary = [String : DatabaseValueConvertible?]()
|
||||
for (column, value) in zip(defaultColumnNames, values) {
|
||||
dictionary[column] = value
|
||||
}
|
||||
return dictionary
|
||||
}
|
||||
|
||||
var description: String {
|
||||
return "[" + ", ".join(values.map { value in
|
||||
@@ -240,17 +222,16 @@ public struct Bindings {
|
||||
// Support for dictionary-based bindings
|
||||
private struct BindingsDictionaryImpl : BindingsImpl {
|
||||
let dictionary: [String: DatabaseValueConvertible?]
|
||||
|
||||
init(dictionary: [String: DatabaseValueConvertible?]) {
|
||||
self.dictionary = dictionary
|
||||
}
|
||||
|
||||
func bindInStatement(statement: Statement) {
|
||||
for (key, value) in dictionary {
|
||||
statement.bind(value, forKey: key)
|
||||
}
|
||||
}
|
||||
func dictionary( defaultColumnNames defaultColumnNames: [String]?) -> [String : DatabaseValueConvertible?] {
|
||||
return dictionary
|
||||
}
|
||||
|
||||
var description: String {
|
||||
return "[" + ", ".join(dictionary.map { (key, value) in
|
||||
@@ -328,7 +309,6 @@ public struct Bindings {
|
||||
// The protocol for Bindings underlying implementation
|
||||
protocol BindingsImpl : CustomStringConvertible {
|
||||
func bindInStatement(statement: Statement)
|
||||
func dictionary(defaultColumnNames defaultColumnNames: [String]?) -> [String: DatabaseValueConvertible?]
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user