Storm/Sources/StORM
thislooksfun 6d27a7b86a Add modifyValue(_:,forKey:)
This adds and implements `open func modifyValue(_ v: Any?, forKey k: String) -> Any` to the `StORM` class.
The intent of this addition is to allow base classes to optionally change the data sent to the database. For example, I am using it to properly handle `Optional`s and the `Date` class in PostgreSQL as follows:
```swift
override func modifyValue(_ val: Any, forKey k: String) -> Any {
	var v = val
	if let o = val as? OptionalProtocol {
		if o.isSome() {
			v = o.unwrap() // not-nil
		} else {
			return ""  // nil
		}
	}
	// After this point, v is guarenteed to not be optional or nil
	
	if let d = v as? Date {
		return d.timestamptz
	}
	
	return v
}
```
The implementations of `OptionalProtocol` and `timestamptz` are irrelevant for this pr.

The `forKey` parameter is there in case someone wants to switch based on name, not on value.

The name is just a placeholder, so feel free to change it if you think of something better.
2017-08-10 00:48:39 -05:00
..
StORM.swift Add modifyValue(_:,forKey:) 2017-08-10 00:48:39 -05:00
StORMConnect.swift Doc Comments! 2016-12-07 15:16:02 -05:00
StORMCursor.swift Doc Comments! 2016-12-07 15:16:02 -05:00
StORMDataSource.swift Doc Comments! 2016-12-07 15:16:02 -05:00
StORMDataSourceCredentials.swift Doc Comments! 2016-12-07 15:16:02 -05:00
StORMDataSourceOptions.swift open->public; update for linux builds 2016-12-08 11:29:26 -05:00
StORMError.swift Doc Comments! 2016-12-07 15:16:02 -05:00
StORMJoins.swift Doc Comments! 2016-12-07 15:16:02 -05:00
StORMProtocol.swift Doc Comments! 2016-12-07 15:16:02 -05:00
StORMRow.swift Doc Comments! 2016-12-07 15:16:02 -05:00
StORMtResultSet.swift Doc Comments! 2016-12-07 15:16:02 -05:00