mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-12 01:17:29 +01:00
34 lines
719 B
Swift
34 lines
719 B
Swift
//
|
|
// DatabaseTable.swift
|
|
// RSDatabase
|
|
//
|
|
// Created by Brent Simmons on 7/16/17.
|
|
// Copyright © 2017 Ranchero Software, LLC. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
public protocol DatabaseTable {
|
|
|
|
public var name: String {get}
|
|
|
|
public init(name: String)
|
|
}
|
|
|
|
extension DatabaseTable {
|
|
|
|
public func selectRowsWhere(key: String, equals value: Any, in database: FMDatabase) -> FMResultSet? {
|
|
|
|
return database.rs_selectRowsWhereKey(key, equalsValue: value, tableName: self.name)
|
|
}
|
|
|
|
public func deleteRowsWhere(key: String, equalsAnyValue values: [Any], in database: FMDatabase) {
|
|
|
|
if values.isEmpty {
|
|
return
|
|
}
|
|
|
|
database.rs_deleteRowsWhereKey(key, inValues: values, tableName: name)
|
|
}
|
|
}
|