我如何在((1,2),(3,4)中运行CQL查询“(Col1,col2));与gocqlx?
好吧,标题可能不太有用,对不起。
如果我使用
qb.Select(...)
.Where(
qb.Eq("part_key_col1"),
qb.Eq("part_key_col1"),
qb.In("clust_key_col1"),
qb.In("clust_key_col2")
)
,请查询构建器构造:
SELECT ...
WHERE part_key_col1 = ?
AND part_key_col1 = ?
AND clust_key_col1 IN ?
AND clust_key_col2 in ?
现在,如果我通过2 clust_key_col1
(例如,“ hello”和“ hello”和“ hello”)和2 clust_key_col2
values(“ foo”和“ foo”和“ bar”),它构建:
SELECT ...
WHERE part_key_col1 = ?
AND part_key_col1 = ?
AND clust_key_col1 IN ("hello", "world")
AND clust_key_col2 in ("foo", "bar")
这导致4个可能的匹配:
hello foo
hello bar
world foo
world bar
我应该如何使用gocqlx qb构造此查询:where(part_key_col1,part_key_col2)in((“ hello”,“ hello”,“ foo”),(“ world” “,” bar“”))
?我想通过任意数量的元素。
Well, the title may be not quite informative, sorry.
If I use
qb.Select(...)
.Where(
qb.Eq("part_key_col1"),
qb.Eq("part_key_col1"),
qb.In("clust_key_col1"),
qb.In("clust_key_col2")
)
, query builder constructs:
SELECT ...
WHERE part_key_col1 = ?
AND part_key_col1 = ?
AND clust_key_col1 IN ?
AND clust_key_col2 in ?
Now if I pass, say, 2 clust_key_col1
(e.g. "hello" and "world") and 2 clust_key_col2
values ("foo" and "bar"), it builds:
SELECT ...
WHERE part_key_col1 = ?
AND part_key_col1 = ?
AND clust_key_col1 IN ("hello", "world")
AND clust_key_col2 in ("foo", "bar")
This leads to 4 possible matches:
hello foo
hello bar
world foo
world bar
How should I use gocqlx qb to construct this query: WHERE (part_key_col1, part_key_col2) IN (("hello", "foo"), ("world", "bar"))
? I want to pass arbitrary number of elements.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在快速研究中,在使用() operator中使用
时,GoCQLX查询构建器似乎都支持复杂的嵌套。
您最好与Scylla的团队一起记录门票。我已经标记了您的问题,希望有人会看到它。您还可以创建针对gocqlx存储库的问题。干杯!
On a quick research, it doesn't appear as though the GoCQLX query builder supports complex nesting when using the
IN()
operator.You have better luck logging a ticket with the team at Scylla. I've tagged your question so hopefully someone will see it. You can also create an issue against the GoCQLX repository. Cheers!