Commit Graph

22 Commits

Author SHA1 Message Date
Ryan Coyne 1d40673a97 Working on last update to storm for specifying in an override function, the primary key for a table/model 2017-11-24 12:48:45 -05:00
Ryan Coyne 42dd9f0ed7 Last changes for backwards compatability 2017-11-24 11:55:33 -05:00
Ryan Coyne 2c249319af Working on backwards compatability for when we mirror 2017-11-24 11:40:37 -05:00
Ryan Coyne ad1f579cea Making it so StORM has the backwards capability for this update 2017-11-24 11:13:11 -05:00
Ryan Coyne 4fda089074 Updating the cols function 2017-11-24 09:03:58 -05:00
Ryan Coyne 1028767f54 Cleaning up the storm module for what I need in the postgresStorm module 2017-11-24 09:00:49 -05:00
Ryan Coyne 7fbe972873 Working on subclassing the postgres-storm object 2017-11-22 20:59:21 -05:00
TheSantaClaus 027706cf8d Make asData and asDataDict functions open 2017-11-01 18:35:11 +02:00
Ryan Coyne a9a532ddc6 Removed out the old commented code 2017-08-15 09:15:11 -04:00
Ryan Coyne 4ee391dcd5 Modifying print statement for an unexpected type for primary keys 2017-08-13 14:56:21 -04:00
Ryan Coyne 1cbb94d729 Adding in the changes to consider optionals when checking if the keyIsEmpty 2017-08-13 14:51:52 -04:00
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
Jonathan Guthrie dde705a0a9 Adding support for storing [String] as comma delimited strings 2017-04-06 16:26:40 -04:00
Jonathan Guthrie 2a3e52b7a5 Doc Comments! 2016-12-07 15:16:02 -05:00
Jonathan Guthrie a2e274276b Add asDataDict, add filter for varnames with _ 2016-12-02 18:54:40 -05:00
Jonathan Guthrie b5a7dda2ea adding support for json encoded objects 2016-11-11 14:49:05 -05:00
Jonathan Guthrie f711b873f8 adding var StORMdebug 2016-10-20 10:14:58 -04:00
Jonathan Guthrie 54d3e15efb add internal_ column exclusion 2016-10-18 10:20:27 -04:00
Jonathan Guthrie 500c302c05 add keyIsEmpty, create, asData, change cols to return array not dict
add not implemented to error
2016-10-06 10:19:16 -04:00
Jonathan Guthrie 29c4a71dc3 add errorMsg property 2016-10-05 15:15:07 -04:00
Jonathan Guthrie 0e7288c2ba adding start of introspection 2016-10-05 10:31:08 -04:00
Jonathan Guthrie 2a0cc5e27b updating naming so it's consistent 2016-09-30 16:47:58 -04:00