jspizziri / sequelize-singleton Goto Github PK
View Code? Open in Web Editor NEWA simple singleton wrapper for the sequelize ORM, making it easier to configure and build models.
A simple singleton wrapper for the sequelize ORM, making it easier to configure and build models.
Is it possible to make this work with multiple databases if not how you would suggest that this can be implemented?
i think, dive have error:
dive(path, action); // Dive into the directory -> dive(path, action, matcher); // Dive into the directory
Thanks for putting this together. This is a helpful library.
I have an enhancement request. Can you allow db.logger
to be a function? That way a custom logging function could be passed in rather than console.log
, just like Sequelize.
Hi jspizziri,
Is it possible you can change your package.json to include all versions of sequelize >= 2.0? I'd like to give this a package a try with more recent versions of sequelize. This is the error I receive when trying to install sequelize-singleton with [email protected]:
npm ERR! peerinvalid The package sequelize does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants sequelize@~2.0
If possible, please update the peerDependencies in your package.json:
"peerDependencies": {
"sequelize": ">=2.0"
},
// somefile.js
var orm = require('sequelize-singleton');
var sequelize = orm.sequelize;
var Sequelize = orm.Sequelize;
var models = orm.models;
var User = models.User;
In your example, you seem to be able to retrieve a model from anywhere.
However, if you do that while connect has not been called already, then you're screwed because your models variable will be empty at first.
This means you cannot require your singleton and get your models if it's not already connected.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.