Adding required info for DSN/Socket
This commit is contained in:
parent
aa28a85065
commit
8b0578ef36
|
@ -32,9 +32,10 @@ open class StORMConnect {
|
||||||
host: String,
|
host: String,
|
||||||
username: String = "",
|
username: String = "",
|
||||||
password: String = "",
|
password: String = "",
|
||||||
port: Int = 0) {
|
port: Int = 0,
|
||||||
|
method: StORMConnectionMethod = .network) {
|
||||||
self.datasource = ds
|
self.datasource = ds
|
||||||
self.credentials = StORMDataSourceCredentials(host: host, port: port, user: username, pass: password)
|
self.credentials = StORMDataSourceCredentials(host: host, port: port, user: username, pass: password, method: method)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,10 @@
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
|
public enum StORMConnectionMethod: String {
|
||||||
|
case socket, network
|
||||||
|
}
|
||||||
|
|
||||||
/// Storage for current datasource connection properties.
|
/// Storage for current datasource connection properties.
|
||||||
public struct StORMDataSourceCredentials {
|
public struct StORMDataSourceCredentials {
|
||||||
|
|
||||||
|
@ -21,13 +25,17 @@ public struct StORMDataSourceCredentials {
|
||||||
/// Password for accessing the datasource.
|
/// Password for accessing the datasource.
|
||||||
public var password: String = ""
|
public var password: String = ""
|
||||||
|
|
||||||
|
/// Set the connection method - network (tcp/ip), or socket/dsn.
|
||||||
|
public var method: StORMConnectionMethod = .network
|
||||||
|
|
||||||
public init() {}
|
public init() {}
|
||||||
|
|
||||||
/// Initializer to set properties at instantiation.
|
/// Initializer to set properties at instantiation.
|
||||||
public init(host: String, port: Int = 0, user: String = "", pass: String = "") {
|
public init(host: String, port: Int = 0, user: String = "", pass: String = "", method: StORMConnectionMethod = .network) {
|
||||||
self.host = host
|
self.host = host
|
||||||
self.port = port
|
self.port = port
|
||||||
self.username = user
|
self.username = user
|
||||||
self.password = pass
|
self.password = pass
|
||||||
|
self.method = method
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue