chenguo / franca-js Goto Github PK
View Code? Open in Web Editor NEWGeneric JSON query object translation to multiple data backends
License: MIT License
Generic JSON query object translation to multiple data backends
License: MIT License
Currently getting this, which is not valid postgres syntax.
WHERE name = \'McDonald\'s\'
Based on what we spec in #4. Implement the insert, edit, and remove.
For example:
query: {
field: 'locality',
match: ['Tucson', null]
}
should equals
query: {
type: 'OR',
queries: [
{field: 'locality', match: ['Tucson']},
{field: 'locality', null: true}
]
}
For match query contains negate=true
query: {
type: "AND",
queries: [
{field: 'locality', match: ['Tucson'], negate: true}
{field: 'locality', null: false}
]
}
When I'm implementing the write operation, I encountered some problems and thought that we may need change the query object schema:
0.) Since the write needs the type, query and option sometime, it's very confusing if we still allow type
to be placed in the top level of query object. We should just put the type
in the query
, insert
or update
, they can specify the type just for query
or write
.
1.) To make the first level keys of query object to be clear, maybe we should put insert
and update
into a key called write
.
Here is the proposed format after the changes:
{
"query": {
"type": "AND",
"queries": []
},
"write": {
"type": "RAW",
"update": ""
},
"options": {
"table": "test-table",
"offset": 100,
"singleRow": true
}
}
@chen-factual what do you think about this?
Hey Chen, can you try to just npm install in a directory, and require franca-js. I was just testing it out and it threw on me. Thanks.
TypeError: Object #<Object> has no method 'toSolr'
at Object.module.exports [as toSolr] (/Users/chen/Code/franca-js/lib/translate/solr.coffee:10:27)
at Object.<anonymous> (/Users/chen/Code/franca-js/test.coffee:43:12)
at Object.<anonymous> (/Users/chen/Code/franca-js/test.coffee:1:1)
at Module._compile (module.js:456:26)
The first toSolr call goes through, second one throws the above exception.
Planning to add support for insert + update operations.
Sometimes, we need to fetch data that are stored in multi tables, especially for relational database. Does franca-js
support this kind of query?
Another question, is it hard to implement a similar lib using ruby?
Currently only the WHERE clause can be RAW. Make it such that the whole query can be RAW.
Why do this when an actual raw query string can be used? Some backend systems may expect a Franca query rather than a string and internally does a .toPg()
.
When I want to get records that with certain mongo _id
, it does works for all the currently query types, such as match
, null
, range
, etc.
@chenguo @fanchen1988 How do you think about adding an Id
type for mongoDB?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.