Restream / reindexer

Embeddable, in-memory, document-oriented database with a high-level Query builder interface.
https://reindexer.io
Apache License 2.0
763 stars 64 forks source link

sql select in string pk #15

Closed gilfanovrrPaker closed 6 years ago

gilfanovrrPaker commented 6 years ago

not working with crush reindexer docker & services select * from projects where id in('21','81','114.2') limit 10 select * from projects where id in('21','81','11') limit 10

working select * from projects where id in('21','114.2') limit 10 select * from projects where id in('21','81') limit 10

type Item struct {
    ID     string   `reindex:"id,,pk" json:"id"` // 'id' is primary key
    Title  string   `reindex:"title,-" json:"title"`
    _      struct{} `reindex:"id+title=text_search,text,composite"`
    Top    bool     `reindex:"top" json:"top"`
    Status string   `reindex:"status" json:"status"`
}
{
  "id": "114.2",
  "title": "Клапан приемный КП-85-21",
  "top": false,
  "created_at": 1505975148,
  "sales_forecast": 0,
  "status": "Закрытый отрицательно"
}
gilfanovrrPaker commented 6 years ago

this works select * from %s where id='21' or id='81' or id='114.2'

js code

var ids, idsText, mappedIds, sql;

  ids = ['21','81','114.2'];

  mappedIds = ids.map(function(id) {
    return "id='" + id + "'";
  });

  idsText = mappedIds.join(' or ');

  sql = "select * from %s where " + idsText;
olegator77 commented 6 years ago

Thank you for bug report. I can reproduce it. We will release hot fix soon.

olegator77 commented 6 years ago

This issue fixed in this commit

Pls check.

gilfanovrrPaker commented 6 years ago

checked, working fine, thanks