Git Product home page Git Product logo

Comments (3)

jperkelens avatar jperkelens commented on September 26, 2024

Hey. We've been quiet on this project for a while, but we're starting to try to pick up again. Hopefully we can get to this in the next week or two. Can you explain the second point about circular dependencies a little more? We typically define a model in its own file and require them, you should be able to create those dependencies that way. However, we haven't run performance tests on something like that, so I can't guarantee good results.

from fastlegs.

gahula avatar gahula commented on September 26, 2024

It is a great project, I am sure all users appreciate the effort.

circular depency (in terms of the variables) e.g.

USERS receive many reviews... REVIEWS are made by many USERS

var Reviews = FastLegS.Base.extend({
tableName: 'reviews',
primaryKey: 'id'
_fields: [
{ 'column_name': 'user_id' },
{ 'column_name': 'author_id' },
{ 'column_name': 'id' },
{ 'column_name': 'comment' }
]
});

var Users = FastLegS.Base.extend({
tableName: 'users',
primaryKey: 'id',
_fields: [
{ 'column_name': 'id' },
{ 'column_name': 'first' },
{ 'column_name': 'last' }
]
many: [
{ 'reviews': Reviews, joinOn: 'user_id' },
//**{'users': Users, joinOn: 'user_id'} Reviews may have many authors, however Users would be UNdefined (yes i know i presently wouldn't be able to connect using user_id).
]
});

If i wanted to perform a join on users and reviews; and at the sametime get the author of those reviews it would NOT be possible since (see **)

User.find({ 'id.in': ['1', '2', '3'] }, {
only: ['id', 'first', 'last'],
order: ['-first'],
include: { 'reviews': {
//* There is no way i can include users here again since i cant say
//
* include on reviews.author_id = users.id
//** FastLegs always assFK to a PK OR two columns that are not Keys
}
}
}, function(err, results) {
//
});

from fastlegs.

gahula avatar gahula commented on September 26, 2024

Relationships will have to be defined outside of the models for e.g. http://nodetoolbox.com/packages/jugglingdb OR https://github.com/1602/jugglingdb they are too tightly coupled to the model.

from fastlegs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.