8000 feat: support mysql `order by` clause for suggest by iceqing · Pull Request #20 · ascoders/syntax-parser · GitHub
[go: up one dir, main page]

Skip to content

feat: support mysql order by clause for suggest #20

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: support mysql order by clause suggest
  • Loading branch information
iceqing committed Jun 19, 2023
commit ff34b6566f12ea533503bda567b07861ca781186
8 changes: 7 additions & 1 deletion src/demo/sql-parser/mysql/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ const selectStatement = () => {
from: ast[2],
};

if(ast[3]) {
result.orderBy = ast[3];
}

if (ast[5]) {
// eslint-disable-next-line prefer-destructuring
result.union = ast[5];
Expand Down Expand Up @@ -326,7 +330,9 @@ const groupByStatement = () => {

// ----------------------------------- orderBy -----------------------------------
const orderByClause = () => {
return chain('order', 'by', orderByExpressionList)();
return chain('order', 'by', orderByExpressionList)(ast=> {
return ast[2];
});
};

const orderByExpressionList = () => {
Expand Down
0