Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feathers-loopback-connector plugin #556

Closed
kethan opened this issue Apr 19, 2017 · 9 comments
Closed

feathers-loopback-connector plugin #556

kethan opened this issue Apr 19, 2017 · 9 comments

Comments

@kethan
Copy link

kethan commented Apr 19, 2017

Hi All,
I am sorry to post here and it is not an issue with feathers

https://github.com/kethan/feathers-loopback-connector.

This is my first attempt to create a feathers plugin. I created for loopback-connector.
Still, it is in alpha stage.
Can anyone look at the code and give their feedback.
I tried running feathers-service-tests I am having 4 issues can anyone help me resolve it.

Thanks.

@marshallswain
Copy link
Member

@kethan, I'll try to look soon. What is the benefit that this adapter will provide?
I'm not familiar with loopback connector. Will this plugin provide access to the databases listed in this page? http://loopback.io/doc/en/lb2/Database-connectors.html

@kethan
Copy link
Author

kethan commented Apr 19, 2017

@marshallswain Yes you are right it will work with all the databases listed and any other built for future too will work.

Example for MongoDB

var loopbackConnector = require('feathers-loopback-connector');
var DataSource = require('loopback-datasource-juggler').DataSource;
var ModelBuilder = require('loopback-datasource-juggler').ModelBuilder;
var ds = new DataSource({
    connector: require('loopback-connector-mongodb'),
    host: 'localhost',
    port: 27017,
    database: 'mydb'
});
var MessageSchema = ds.createModel('message', {
    title: { type: String },
    body: { type: String }
});
app.use('/messages', loopbackConnector({
    Model: MessageSchema,
    paginate: {
        default: 2,
        max: 4
    }
}));

module.exports = app.listen(3030);

Cassandra connector
Cloudant connector
DashDB
DB2 connector
DB2 for iSeries connector
DB2 for z/OS
Informix connector
MongoDB connector
MySQL connector
Oracle connector
PostgreSQL connector
Redis connector
Redis key-value connector
SQL Server connector
SQLite3 connector

@daffl
Copy link
Member

daffl commented Apr 21, 2017

@kethan This looks great, nice job! I can definitely help with the failing tests. Can I just clone your repository and run the tests to see what is happening or is there any setup involved?

@kethan
Copy link
Author

kethan commented Apr 21, 2017

@daffl I am just a beginner and I learned seeing many of your repo you are an expert friend. You can just clone it and run the tests. But please note the code is not perfect and optimised as yours.

@kethan
Copy link
Author

kethan commented May 1, 2017

@marshallswain Did you check? was it useful?
@daffl Did you clone? Were you able to run the tests?

@daffl
Copy link
Member

daffl commented May 1, 2017

@kethan Yep I cloned it and it looks great (sorry, I've been meaning to reply earlier but I was hoping I could just make a PR but didn't get a chance yet)! I can see why those tests are failing. Do you know if nested $or queries are possible with Loopback at all? How would they look like?

@kethan
Copy link
Author

kethan commented May 1, 2017

@daffl Thanks.
Hi yes it is possible

//it should be like this 
or : [
     or: [conditions],
     or: [conditions],
]
//From loopback docs
//Example using the “or” operator to finds posts that either have title of “My Post” or content of “Hello”.

Post.find({where: {or: [{title: 'My Post'}, {content: 'Hello'}]}}, 
          function (err, posts) {
            ...
});
//More complex example. The following expresses (field1= foo and field2=bar) OR field1=morefoo:

{
   or: [
     { and: [{ field1: 'foo' }, { field2: 'bar' }] },
     { field1: 'morefoo' }
   ]
 }

@daffl
Copy link
Member

daffl commented Dec 6, 2017

Thanks again for sharing this! I'm closing this issue since I never used Loopback and unfortunately don't have the time to look into it more. I added it to our Feathers list though.

@daffl daffl closed this as completed Dec 6, 2017
daffl pushed a commit that referenced this issue Aug 29, 2018
…#556)

This reverts commit b375ae6baf7f48e6dde69c3dd9a7252956f449ed.
daffl pushed a commit that referenced this issue Aug 29, 2018
…#556)

This reverts commit b375ae6baf7f48e6dde69c3dd9a7252956f449ed.
@lock
Copy link

lock bot commented Feb 7, 2019

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue with a link to this issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Feb 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants