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
459 stars 12 forks source link

Add a default for `UUID` primary keys #9

Closed helje5 closed 2 years ago

helje5 commented 2 years ago

Let's say we have:

CREATE TABLE talent (
  talent_id UUID NOT NULL,
  name      TEXT NOT NULL
);

which generates

struct Talent {
  var id   : UUID
  var name : String
  init(id: UUID, name: String) { ... }
}

it would be nice if the init would be init(id: UUID = UUID(), name: String). As that kinda is the sane thing to do for new records.

helje5 commented 2 years ago

Implemented.