updating naming so it's consistent
This commit is contained in:
parent
ccc06cfee3
commit
2a0cc5e27b
|
@ -1,71 +0,0 @@
|
|||
//
|
||||
// Connect.swift
|
||||
// StORM
|
||||
//
|
||||
// Created by Jonathan Guthrie on 2016-09-23.
|
||||
//
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
protocol StORMProtocol {
|
||||
func select() -> String
|
||||
func create() -> String
|
||||
func update() -> String
|
||||
func upsert() -> String
|
||||
func delete() -> String
|
||||
|
||||
}
|
||||
|
||||
open class Connect {
|
||||
|
||||
open var datasource = DataSource()
|
||||
open var credentials = DataSourceCredentials()
|
||||
|
||||
open var database: String = ""
|
||||
|
||||
/// Manually set table
|
||||
// Convenience shortcut var
|
||||
open var table: String = ""
|
||||
|
||||
/// Last executed statement
|
||||
public var statement: String = ""
|
||||
|
||||
/// Last executed statement
|
||||
public var resultCode: StORMError = .noError
|
||||
|
||||
public init() {}
|
||||
|
||||
public init(_ ds: DataSource,
|
||||
host: String,
|
||||
username: String = "",
|
||||
password: String = "",
|
||||
port: Int = 0) {
|
||||
self.datasource = ds
|
||||
self.credentials = DataSourceCredentials(host: host, port: port, user: username, pass: password)
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// public func select() -> String {
|
||||
// return "selected"
|
||||
// }
|
||||
// public func create() -> String {
|
||||
// return "created"
|
||||
// }
|
||||
// public func update() -> String {
|
||||
// return "updated"
|
||||
// }
|
||||
// public func upsert() -> String {
|
||||
// return "upserted"
|
||||
// }
|
||||
// public func delete() -> String {
|
||||
// return "deleted"
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
//
|
||||
// StORM.swift
|
||||
// StORM
|
||||
//
|
||||
// Created by Jonathan Guthrie on 2016-09-30.
|
||||
//
|
||||
//
|
||||
|
||||
class StORM {
|
||||
var cursor = StORMCursor()
|
||||
var error = StORMError()
|
||||
var results = StORMResultSet()
|
||||
var connection = StORMConnect()
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
//
|
||||
// Connect.swift
|
||||
// StORM
|
||||
//
|
||||
// Created by Jonathan Guthrie on 2016-09-23.
|
||||
//
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
open class StORMConnect {
|
||||
|
||||
open var datasource = StORMDataSource()
|
||||
open var credentials = StORMDataSourceCredentials()
|
||||
|
||||
open var database: String = ""
|
||||
|
||||
/// Manually set table
|
||||
// Convenience shortcut var
|
||||
open var table: String = ""
|
||||
|
||||
/// Last executed statement
|
||||
public var statement: String = ""
|
||||
|
||||
/// Last executed statement
|
||||
public var resultCode: StORMError = .noError
|
||||
|
||||
public init() {}
|
||||
|
||||
public init(_ ds: StORMDataSource,
|
||||
host: String,
|
||||
username: String = "",
|
||||
password: String = "",
|
||||
port: Int = 0) {
|
||||
self.datasource = ds
|
||||
self.credentials = StORMDataSourceCredentials(host: host, port: port, user: username, pass: password)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
public enum DataSource {
|
||||
public enum StORMDataSource {
|
||||
case Postgres
|
||||
case MySQL
|
||||
case FileMaker
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
public struct DataSourceCredentials {
|
||||
public struct StORMDataSourceCredentials {
|
||||
public var host: String = "localhost"
|
||||
public var port: Int = 0
|
||||
public var username: String = ""
|
|
@ -10,7 +10,7 @@ import Foundation
|
|||
|
||||
|
||||
// add options as they are determined
|
||||
enum DataSourceOptions {
|
||||
enum StORMDataSourceOptions {
|
||||
case SSL(Bool)
|
||||
}
|
||||
|
|
@ -10,4 +10,8 @@ public enum StORMError: String {
|
|||
case database = "No Database Specified"
|
||||
case error = "Error"
|
||||
case noError = "No Error"
|
||||
|
||||
init(){
|
||||
self = .noError
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,22 +8,22 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
public struct DataSourceJoin {
|
||||
public struct StORMDataSourceJoin {
|
||||
public var table: String = ""
|
||||
public var direction: JoinType
|
||||
public var direction: StORMJoinType
|
||||
public var onCondition: String = ""
|
||||
|
||||
public init() {
|
||||
direction = .normal
|
||||
}
|
||||
public init(table: String, onCondition: String = "", direction: JoinType = .normal) {
|
||||
public init(table: String, onCondition: String = "", direction: StORMJoinType = .normal) {
|
||||
self.table = table
|
||||
self.direction = direction
|
||||
self.onCondition = onCondition
|
||||
}
|
||||
}
|
||||
|
||||
public enum JoinType {
|
||||
public enum StORMJoinType {
|
||||
case INNER
|
||||
case OUTER
|
||||
case LEFT
|
Loading…
Reference in New Issue