I'm trying to understand how the await
keyword is being used in KNEX. Take the following example:
knex.schema.createTable( ... );
this will return this
which is an instance of SchemaBuilder. It will not execute the create table query in the database. However if I stick and await
in front of it.
await knex.schema.createTable( ... );
This will now execute the create query in the database.
My understanding is that await
is used to wait for a promise resolution but in this case it feels like something else is going on because not await
ing the function doesn't return a promise.
How does this work?
Aucun commentaire:
Enregistrer un commentaire