crud
crud copied to clipboard
Support field id in select/pairs conditions
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 https://github.com/tarantool/crud/blob/3f2db887d13c00a0f1f402f59fba795fb39e5703/crud/common/utils.lua#L591-L618). 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 https://github.com/tarantool/crud/issues/255) since we expect space schema to be the same everywhere.
The one reason why it isn't supported yet may be the support of both indexes and fields in conditions. User may try to set index id which will be treated as field id.
@DifferentialOrange @dkasimovskiy
May we better add index id cause we can't use PK without knowing the name? It's so important if you use API like spring-data. There you have methods that use primary key(findById) and it's pain to inject index name
upd: I forgot about the get method. Get method fixes our problem, then we don't need select with index id. Sorry
May we better add index id cause we can't use PK without knowing the name
The main controversy behind this question is "whether id is field id or index id"? On the other hand, we have the same controversy for index/field names already. If you decide that you want that feature nonetheless, we may reconsider it. For now, yeah, you may use get
However when we deal with spring-data repository.containsById method, we may encounter a problem with unpredictable record size. Receiving huge data over network just for checking for record presence may be problematic, especially in case when containsById is being called frequently.
@ArtDu @DifferentialOrange
@bitgorbovsky I think it's relative to this ticket. Need to create a new one "Add contains method"
However when we deal with spring-data repository.containsById method, we may encounter a problem with unpredictable record size.
I have no idea what repository.containsById
is, but you can always limit crud.select
output with first=N
option or use crud.count
which responds with a single number.