Lighter
Lighter copied to clipboard
Directly parse SQL selects and generate VIEW like structs for them
Instead of heaving to create a view like this:
CREATE VIEW fun_sum
AS SELECT SUM(intCol) + SUM(doubleCol) AS lol FROM fun;
It would be nice if sqlite2swift
could directly generate code for a SELECT
expression, like:
-- Swift: fetchSums
SELECT SUM(intCol) + SUM(doubleCol) AS lol FROM fun;
Similar to SQLDelight.
This has one big advantage, a binding could be specified at compile time, like:
-- Swift: fetchSums
SELECT SUM(intCol) + SUM(doubleCol) AS lol FROM fun WHERE year = $1;
And added to the fetch function, like:
db.fun.fetchSums(1973)