Lighter-swift / Lighter

Swift APIs for SQLite: Type-safe down to the schema. Very, very, fast. Dependency free.
https://lighter-swift.github.io/documentation/lighter/
MIT License
460 stars 12 forks source link

Add support for JSON columns? #26

Open helje5 opened 1 year ago

helje5 commented 1 year ago

Not quite sure how that would look like. Presumably we'd detect the column type JSON and then allow SQLite JSON operations on it? How would it look in the associated structure? Expose it as Data, but at least in the Lighter API provide a wrapper that allows direct access?

struct Person {
  var name: String
  var privateAddress: [ UInt8 ] // in raw API?
  var businessAddress: [ UInt8 ] // in raw API?
}

struct Address: Codable {
  var street: String
  var city: String
}

We can't use Codable directly here (and Codable is really slow anyways, so not that desirable).