gpt4 book ai didi

node.js - 通过 sails.js 中的关联

转载 作者:搜寻专家 更新时间:2023-10-31 22:48:09 26 4
gpt4 key购买 nike

前一段时间我问如何执行“通过协会”。我有以下表格:

genres
+-----------+--------------+------+-----+
| Field | Type | Null | Key |
+-----------+--------------+------+-----+
| id | int(6) | NO | PRI |
| slug | varchar(255) | NO | |
| parent_id | int(11) | YES | MUL |
+-----------+--------------+------+-----+
genres_radios
+----------+--------+------+-----+
| Field | Type | Null | Key |
+----------+--------+------+-----+
| genre_id | int(6) | NO | MUL |
| radio_id | int(6) | NO | MUL |
+----------+--------+------+-----+
radios
+-----------+--------------+------+-----+
| Field | Type | Null | Key |
+-----------+--------------+------+-----+
| id | int(5) | NO | PRI |
| slug | varchar(100) | NO | |
| url | varchar(100) | NO | |
+-----------+--------------+------+-----+

答案就在那里:Sails.js associations .

现在我想知道,如果我在 genres_radios 表中有一个新字段,例如:

genres_radios
+----------+--------+------+-----+
| Field | Type | Null | Key |
+----------+--------+------+-----+
| genre_id | int(6) | NO | MUL |
| new_field| int(10)| NO | |
| radio_id | int(6) | NO | MUL |
+----------+--------+------+-----+

如何在进行连接时获取该属性?

最佳答案

还没有实现。引用 Waterline's documentation :

Many-to-Many Through Associations

Many-to-Many through associations behave the same way as many-to-many associations with the exception of the join table being automatically created for you. This allows you to attach additional attributes onto the relationship inside of the join table.

Coming Soon

关于node.js - 通过 sails.js 中的关联,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29562147/

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