Commit Graph

6 Commits

Author SHA1 Message Date
Matthew Chen
a5a50e572d Add simple unit test around SDSDatabaseStorage, serialization, etc. 2019-04-11 11:58:44 -04:00
Matthew Chen
6ea3a321e0 Re-introduce the SDSTransaction classes; add "any" methods for save, fetch that discriminate transaction type. 2019-04-11 11:01:54 -04:00
Michael Kirk
0fe0dfc409 DO NOT MERGE - Slash and Burn
This is a POC whose primary goal was to have column values return DatabaseValueConvertible

We missed several non-convertible fields with just the threads class, we'll
miss others while developing the mgiration and in the future when adding
properties.

DatabaseValueConvertible is Swift only, but our SDSSerializable protocol was objc.

Though we weren't using the SDSSerializable methods in objc, we were taking
advantage of the fact that methods defined in @objc extensions can override
other methods defined in extensions on their superclass.

e.g. TSGroupThread can override `columnValues` and call super.columnValues even
though both are defined in extensions, because they are @objc extensions

This isn't allowed in Swift, because it's not safe (overrideing in an extension
can clobber another extension's method). There's an old proposal about adding a
limited safe form of the functionality to the language:

https://github.com/jrose-apple/swift-evolution/blob/overridable-members-in-extensions/proposals/nnnn-overridable-members-in-extensions.md

I'm not actually super concerned about the "unsafeness" of the extensions
approach in terms of clobbering methods, but because I want to leverage
Swift's DatabaseValueConvertible, we'd be forced to address it.

In this commit I kind of shuffle things around so that most of the SDS
serializing functionality is _not_ defined in an extension, but rather in a
parallel class hierarchy of Serializers.

SDSSerializable then becomes a very small protocol whose only responsibility is
to provide an instance of SDSSerializer.
2019-04-11 09:16:35 -04:00
Michael Kirk
47e12556aa Use SDSSerialization to create tables and insert in migration 2019-04-11 09:16:27 -04:00
Michael Kirk
ee3697793a GRDB adapter for message mapping 2019-04-10 16:28:18 -06:00
Michael Kirk
54311df296 Database Singleton, type erased transaction 2019-04-05 10:50:45 -06:00