tink_sql icon indicating copy to clipboard operation
tink_sql copied to clipboard

Rework update

Open back2dos opened this issue 8 years ago • 0 comments

I think we need to change update to be generated for every table.

var foobar = new Table<{ foo:Int, bar: Bool }>();
$type(foobar.update);// { ?foo:Expr<Int>, ?bar:Expr<Bool> }

For one I don't see much progress on overloading = while field.set() horribly awkward. But also it actually is safer, because it prevents having two updates for the same field, which you can do currently:

foobar.update(row -> [row.foo.set(4), row.foo.set(5)];

The downside to this is that you can't combine updates so easily, as in:

foobar.update(row -> update1(row).concat(update2(row));

But I suppose it's all just a matter of extracting object merging from tink_hxx (or just have some simple reflection based thingy).

Generally, Update<Row> will become a @:genericBuild lifting any row structure to its update counterpart.

back2dos avatar May 22 '17 05:05 back2dos