我需要從一個空間的兩個值中選擇tarantool全部數據。 如何在mysql中執行tarantool請求?如何在mysql中執行tarantool請求?
select from aaa where a=1a22cadbdb or a=7f626e
現在我可以提出兩點要求:
box.space.logs:select({'1a22cadbdb'})
box.space.logs:select({'7f626e0123'})
,但我不知道怎麼的結果合併成一個;(
我需要從一個空間的兩個值中選擇tarantool全部數據。 如何在mysql中執行tarantool請求?如何在mysql中執行tarantool請求?
select from aaa where a=1a22cadbdb or a=7f626e
現在我可以提出兩點要求:
box.space.logs:select({'1a22cadbdb'})
box.space.logs:select({'7f626e0123'})
,但我不知道怎麼的結果合併成一個;(
下面的代碼合併域[0]到Lua表
a = box.space.logs:select({'1a22cadbdb'})
b = box.space.logs:select({'7f626e0123'})
c = { field_1 = a[0], field_2 = b[0] }
的選擇返回元組或元組,因此您可以通過提取[]值。
個更多選擇細節:http://tarantool.org/doc/book/box/box_index.html?highlight=select#lua-function.index_object.select
更多細節元組:http://tarantool.org/doc/book/box/box_tuple.html?highlight=tuple#lua-module.box.tuple
對我來說,這項工作很好,但需要做檢查的回報從第一選擇:
local res = {}
for k, v in pairs (box.space.email:select({email})[1]) do
if type(v) == 'string' then
table.insert(res, box.space.logs:select({v})[1])
end
end