You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
Enhancement suggestion: I have stumbled multiple times over the fact, that values expects an array and can't handle a call where I provide a single row (which gives the not-so-descriptive error "rows.some is not a function").
Said differently: I would expect the following the work let pendingRequestTable = connection.getSchema().table("PendingRequests"); let data = {url,method,body, timestamp: (new Date()).valueOf()}; let requestRow = pendingRequestTable.createRow(data); connection.insertOrReplace().into(pendingRequestTable).values(requestRow).exec();
The text was updated successfully, but these errors were encountered:
valioDOTch
changed the title
Cks
Consider accepting a single row when calling values()
Jun 13, 2017
This sounds reasonable. When we first designed this API we wanted (and still do) to avoid runtime type checking (like detecting if an array or a single value was passed). Perhaps a different way to address the issue is to add a value() method, that accepts a single value and leave values() semantics as is.
FWIW, another enhancement I've thought about (but never got to implement), is to stop requiring calling code to call createRow() first, instead call this internally. So in your example you would be passing data straight to values().
I assumed that performance might be an issue for this decision.
I think the "value" approach would be a possibility (albeit being at odds with SQL syntax).
I would be in favour of omitting the createRow call.
I haven't met a case yet where the explicit call would add further value.
Enhancement suggestion: I have stumbled multiple times over the fact, that values expects an array and can't handle a call where I provide a single row (which gives the not-so-descriptive error "rows.some is not a function").
Said differently: I would expect the following the work
let pendingRequestTable = connection.getSchema().table("PendingRequests"); let data = {url,method,body, timestamp: (new Date()).valueOf()}; let requestRow = pendingRequestTable.createRow(data); connection.insertOrReplace().into(pendingRequestTable).values(requestRow).exec();
The text was updated successfully, but these errors were encountered: