Comments (5)
@neilk they're not quite the same... in the second example, deleteTile
is called immediately, it either needs to return a function, or the then needs to take an anonymous function:
function deleteTile(tile) {
return function() {
return db('tilestofetch').where(tile).delete();
};
}
or:
createTile()
.then(function() {
return deleteTile(tile)
})
(I'm not sure if that is the issue, but it might be part of it).
from knex.
Ah. I guess I thought then() was smart enough to recognize another promise. Thanks!
from knex.
@neilk - it is, but in this case you're invoking it immediately... effectively turning it into a value rather than a handler function.
from knex.
Now I'm confused again. What makes db('tilestofetch').where(tile).delete()
invoke immediately, without .exec()
or .then()
?
from knex.
Sorry, I didn't mean that it'd invoke immediately, it's just that it's just an object, not a function, and the onFulfilled
has to be a function (spec)... so if you returned a value from that function with a then
method that hasn't been called yet it'd be coerced into a promise, but otherwise just tossing an object that could turn into promise into the onFulfilled
slot wouldn't be expected behavior.
from knex.
Related Issues (20)
- The value of a Date type field is shared by multiple records. (With Oracle Client)
- SQLITE_NOTADB: file is not a database with SQLCipher
- Add comments to promise aware knex transaction commits
- Using Jest with Knex, I get 'Error: Unable to acquire a connection' every time HOT 1
- Parse a query string back to QueryBuilder object?
- Transaction method resolves if the provided callback rejects with `undefined`.
- insert() with typescript
- Casing issues
- connection string isn't working
- Raw query HOT 6
- directory option should take absolute paths HOT 1
- limit() is not working with delete()
- Update multiple fields. One field not updated sometimes
- Wrong TypeScript type when using .count('*')
- pglite support
- esm migrations does not work on Node 22
- Straightforward way of getting the PID of a query, ahead-of-time.
- can't extend existing method
- Error without actual reason in CLI due to TypeScript error
- Unknown pending operation error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from knex.