Open kevinresol opened 4 years ago
A few notes on implementation:
insert
queryselect
queryFormatting/printing SQL has always been the easy part to tink_sql changes :) What's the added benefit over making it part of the select (and thereby also supporting databases without computed columns)?
Maybe my description was confusing, I meant this:
$type(db.Table.insertOne)
=> {nonComputed:String}->Promise<Int>
$type(db.Table.first())
=> Promise<{nonComputed:String, computed:String}>
db.Table.select($type({...}))
=> {?nonComputed, ?computed}
So what I mean is simply: computed values should be supported as readonly.
I can see why this would be useful. OTOH I wonder if it's not easier and more portable to have the computation in application code rather than the database?
Computed columns can be used for (speeding up) aggregation. So no, I don't think they are equivalent.
MySQL/Postgres: (Postgres does not support VIRTUAL)
SQL server:
Proposed Haxe syntax: