gpt4 book ai didi

ruby-on-rails - node.js 世界中的 ActiveRecord 等价是什么?

转载 作者:IT老高 更新时间:2023-10-28 22:06:50 27 4
gpt4 key购买 nike

我正在考虑将 node.js 工具用于即将进行的项目,用于学习和性能目的。 For example , Rails 中的一些模型:

class User
has_many :topics
has_many :friends
has_many :friend_users, :through => :friends
has_many :friend_topics, :through => :friend_users, :source => :topics
end

class Friend
belongs_to :user
belongs_to :friend_user, :class_name => "User",
:foreign_key => :phone_no, :primary_key => :phone_no
end

class Topic
belongs_to :user
end

允许优雅的查询代码,例如:

latest_10_topics_from_friends = current_user.friend_topics.limit(10)

并生成优化的 SQL。 node.js 生态系统中是否有类似的东西?

最佳答案

Waterline 似乎正是您要找的东西。它是由 Sails 项目背后的同一个人创建的。

https://github.com/balderdashy/waterline

关于ruby-on-rails - node.js 世界中的 ActiveRecord 等价是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11393438/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com