Skip to content

Support field id in select/pairs conditions #352

Open
@DifferentialOrange

Description

@DifferentialOrange

Follows #350

Update conditions support field number ids (moreover, due to compatibility with older Tarantool, all non-number identificators are converted to number ones, see

crud/crud/common/utils.lua

Lines 591 to 618 in 3f2db88

function utils.convert_operations(user_operations, space_format)
local converted_operations = {}
for _, operation in ipairs(user_operations) do
if type(operation[2]) == 'string' then
local field_id
for fieldno, field_format in ipairs(space_format) do
if field_format.name == operation[2] then
field_id = fieldno
break
end
end
if field_id == nil then
return nil, ParseOperationsError:new(
"Space format doesn't contain field named %q", operation[2])
end
table.insert(converted_operations, {
operation[1], field_id, operation[3]
})
else
table.insert(converted_operations, operation)
end
end
return converted_operations
end
). Select/pairs are not, see #241 example.

I don't remember hearing any user requests about field id support, so I'll put a question label here. On the other hand, I don't see any reasons against adding this (like there were for space id in #255) since we expect space schema to be the same everywhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA new functionalityquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions