gpt4 book ai didi

Ruby Datamapper 左外连接

转载 作者:数据小太阳 更新时间:2023-10-29 07:39:55 26 4
gpt4 key购买 nike

有没有一种方法可以在 Datamapper 中进行左外连接,而不必直接与数据存储对话。我一直在搜索网络和 Datamapper 文档,但没有成功地了解如何执行此操作的详细信息。

最佳答案

看起来严格的左外连接是相当困难的。

查看网站:

68 # QueryPaths can be used to construct joins in a very declarative manner.
69 #
70 # Starting from a root model, you can call any relationship by its name.
71 # The returned object again responds to all property and relationship names
72 # that are defined in the relationship's target model.
73 #
74 # This means that you can walk the chain of available relationships, and then
75 # match against a property at the end of that chain. The object returned by
76 # the last call to a property name also responds to all the comparison
77 # operators available in traditional queries. This makes for some powerful
78 # join construction!
79 #
80 Customer.all(Customer.orders.order_lines.item.sku.like => "%BLUE%")

查看 docs看起来 Query 类有一个可以识别外键的关系处理程序。

关于Ruby Datamapper 左外连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8418765/

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