sql

sql2es

Use SQL grammar generate ES dsl

Showing:

Popularity

Downloads/wk

1

Maintenance

No Maintenance Data Available

Package

Dependencies

1

Size (min+gzip)

11.8KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

sql2es

Use sql grammar change ES dsl

目前支持语法


&&、||、=、!=、in、and、or、like 

eg:

1. select * from test;

2. select * from test where a = 1;

3. select * from test where a = 1 && b = 2;

4. select * from test where a = 1 && b like "Google";

5. select * from test where (a = 1 || b = 2) && c = 3;

6. select * from test where (a = 1 || b = 2) && c in (1,2,3);

7. select a,b,c from test where (a = 1 || b = 2) && c in (1,2,3);

8. select a,b,c from test where (a = 1 || b = 2) && c like_in (1,2,3);

9. select a,b,c from test limit 1,10;

10. select * from test order by id desc,id2 asc;

用法

var sql2es = require('sql2es');

sql2es('select * from test;', function(err, q) {
  console.log(err, q);
});

Demo

操作符转义对照表

keyvalue
=term
&&must
!=must_not
likequery_string
like_inquery_string
andmust
orshould
interms

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100