NetNewsWire/Frameworks/RSDatabase/DatabaseTable.swift
2017-07-16 20:51:08 -07:00

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)
}
}