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

Name conflict in raw fetches (`sqlite3_talents0_fetch`) #12

Closed helje5 closed 2 years ago

helje5 commented 2 years ago

When generating a DB for this:

CREATE TABLE Talents (
    id   UUID PRIMARY KEY NOT NULL,
    name TEXT NOT NULL
);

The result is mostly OK, but ends up with those SQLite API functions:

public func sqlite3_talents0_fetch(...)

Notice the talents0, it is probably generated by the code which makes the identifiers unique. The CUD functions are fine though:

public func sqlite3_talents_delete(...)
helje5 commented 2 years ago

This happened because the table name is plural already, and singularizeRecordNames is set to false by default. I.e. "talents" already is plural and then clashes with the singular "talents". Changed the fancifier to detect that and deal with the case properly.