Comments (7)
Thanks for the quick update :)
I'm just getting started in the deno / javascript / typescript arena. But in looking to be helpful I came across a reference to dynamic loading of modules. Maybe helpful to you. No rush happy for progress to happen as it does.
https://stackoverflow.com/questions/13444064/typescript-conditional-module-import-export
async function importModule(moduleName):Promise<any>{
console.log("importing ", moduleName);
const importedModule = await import(moduleName);
console.log("\timported ...");
return importedModule;
}
let moduleName:string = "module-a";
importModule(moduleName)
.then(importedModule => {
console.log("importedModule");
});
edit: formatting
from denodb.
Exactly, this is what I have done actually and it works fine. I explained the issue better on their repo: they have an await init(...)
statement which needs to be "done" before using the library. However, when using await import(...)
it does not wait on it, and raises an error!
I don't think it is good practice to have an await
statement in your main file. It should be an additional function that initialises the library, but for now that's all we have.
This is why I said we can only wait or make a fork which isn't ideal at the moment :D
from denodb.
Hey,
Thanks a lot for raising this question, you're right about this.
So basically, after introducing Mongo in denodb, it turned out that we would always need to add --unstable
and others.
I will have a look at it and see if this could only be called when using Mongo and still keeping the codebase consistant.
I will get back to you very soon!
Keep in touch
from denodb.
No worries, thanks for the update.
from denodb.
Alright so a quick update: I rearranged the code for this to be working the way you would expect, e.g. we now only need deno run --allow-net --allow-read ...
to use mysql.
The problem is: deno_mongo
cannot be lazy-loaded correctly, which creates all sorts of problem at the moment (I just asked them if they could do something about it).
So until they get back to me, we will have to wait. I found a solution, could just make a fork and use that fork instead of their github but this is just not a good solution right now.
Unless they can't figure something out, we will do it "the dirty way" then.
Just be patient then, I will update this issue whenever I hear back from them :)
from denodb.
Alright, #57 should have fixed it!
I decided to go with the fork option as it doesn't seem to be changing on the other repo.
You should just use deno run --reload ...
to make sure you get the updated version!
Reopen the issue if it's not working but I guess it should :)
Take care
from denodb.
Hi @eveningkid
Thanks for your work on this, it worked a treat. The whole downloading a DLL and --unstable options didn't sit well against the appeal of security within Deno.
from denodb.
Related Issues (20)
- Crashing when deployed to Deno Deploy HOT 2
- TLS connection failed with message: invalid peer certificate contents / PostgresError: no pg_hba.conf entry for host HOT 5
- Foreign key constraint name defaults to the name of the column
- Serialized Model option rather than classes?
- Can't import the latest version 1.0.40 HOT 5
- How to use denodb to connect to multiple postgresql databases having same models
- [Feature] Support SQL `SELECT DISTINCT`
- insert or update
- hash module break! HOT 4
- sqlite v3.1.3 not working on Windows
- Postgres Foreign Key is created with integer type by default HOT 2
- Timestamps
- Postgres connector makes the script unable to exit normally HOT 1
- How to set logging? HOT 2
- Postgresql: Timestamp fields adding hours each time records are updated
- Multiple Primary Key Exists HOT 1
- Some problems in model.ts
- A dependency is broken HOT 15
- Module not found "https://deno.land/std/node/events.ts". HOT 6
- DenoDB Models' fields without Types?
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 denodb.