tink_sql
tink_sql copied to clipboard
Custom Queries
What is the plan for arbitrary queries?
Depends on what you mean by "arbitrary". What's the use case here?
I am mainly looking for transaction right now. And maybe ALTER table later. I just dunno if we can support all SQL syntax, if not we might want to let user input raw SQL string
Well, the basics should ideally be in in the driver. I'd say ALTER table is one of them - in particular since CREATE table is. And transactions should look something like this:
function transaction<T>(f:Void->Promise<TransactionEnd<T>>):Promise<TransactionEnd<T>>;
enum TransactionEnd<T> {
Commit(result:T);
Rollback;
}
As for arbitrary queries, I suppose they could exist on the particular driver implementation. I wouldn't want to make the ability to process arbitrary SQL dialects part of the general contract :D
Where would the transaction method live? On Connection or Database?
I'd say the Connection should have it and the Database should expose one that just forwards the call.
I'd like to have support for transactions :)