tuple_object:find(), tuple_object:findall()
-
object
tuple_object
¶ -
tuple_object:
find
([field-number, ]search-value)¶ -
tuple_object:
findall
([field-number, ]search-value)¶ If
t
is a tuple instance,t:find(search-value)
will return the number of the first field int
that matches the search value, andt:findall(search-value [, search-value ...])
will return numbers of all fields int
that match the search value. Optionally one can put a numeric argumentfield-number
before the search-value to indicate “start searching at field numberfield-number
.”Return: the number of the field in the tuple. Rtype: number In the following example, a tuple named
t
is created and then: the number of the first field int
which matches ‘a’ is returned, then the numbers of all the fields int
which match ‘a’ are returned, then the numbers of all the fields in t which match ‘a’ and are at or after the second field are returned.tarantool> t = box.tuple.new{'a', 'b', 'c', 'a'} --- ... tarantool> t:find('a') --- - 1 ... tarantool> t:findall('a') --- - 1 - 4 ... tarantool> t:findall(2, 'a') --- - 4 ...
-