Comments (6)
@treefort you're right, and I thought I could just change "like" to "$iLike" here, but it fails on a few tests. Unfortunately that's about all the time I have these day 😄, any interest in trying to figure this one out? PRs are gladly welcomed
from epilogue.
The operator could be passed in has an optional attribute in the search options. ex:
var users = rest.resource({
model: User,
endpoints: ['/users', '/users/:id'],
search: {
param: 'searchOnlyUsernames',
attributes: [ 'username' ],
operator: '$iLike' // (defaults to 'like'
}
});
It's not pretty, but it'd work... plus it wouldn't mess up existing implementations. I can put it in a PR with corresponding tests and stuff, but I wanted to get your thoughts first.
from epilogue.
@treefort I wouldn't be against it, but we should also conform with the docs right? (as in default to iLike). I know this seems sinfully lazy, but I can't even recall what tests broke - did you take a look?
from epilogue.
Basically, any test that uses a substring match failed. If I'm understanding this correctly, sequelize isn't guarding against the fact that iLike is only supported in pg... so it seems like a strange default. Here's how I tested:
User.findAll({where: { username: {$iLike: "%e%"}}})
which resulted in...
Unhandled rejection SequelizeDatabaseError: SQLITE_ERROR: near "ILIKE": syntax error
from epilogue.
aah yeah of course, and mysql does case insensitive searches by default as well as sqlite. Yeah okay, please go ahead and add the operator for pg!
from epilogue.
Awesome. Addressed with #78.
from epilogue.
Related Issues (20)
- Support to check if Postgres array contains string?
- create inserts nulls on postgres db? HOT 1
- Workflow for pull requests? HOT 2
- Typescript support? HOT 4
- AResouce.list.data.after is not called if AResouce.list.data is not presented
- Controller List is not applying attributes of Model Scope as specified in req.query.scope HOT 1
- search by parameter 'q' does not work HOT 12
- Order of associations HOT 1
- repo unmaintained! active fork: https://github.com/tommybananas/finale HOT 4
- How to add another options item while creating an model instance?
- app[self.method] is not a function
- [Read Endpoint] Get data from two models HOT 1
- Filtering/sorting by association fields
- Project status HOT 1
- EpilogueError: internal error HOT 1
- Sorting ignored with hasMany relationships
- How to define all API routes to be in a separate group
- How do I add auth to all actions of a Resource? HOT 1
- How can I assign fetching items to POST request?
- Cannot set headers after they are sent to the client HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from epilogue.