-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a436e9
commit 47b8781
Showing
7 changed files
with
203 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod select_limit; | ||
pub mod select_order; | ||
pub mod select_limit; | ||
pub mod select_projection; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#[cfg(test)] | ||
use crate::lang::tests::helpers::compare_parsed_to_expected; | ||
|
||
#[cfg(test)] | ||
use serde_json::json; | ||
|
||
#[cfg(test)] | ||
use crate::assert_parsing; | ||
|
||
#[cfg(test)] | ||
assert_parsing! { | ||
plain: { | ||
"SELECT * from users;" => { | ||
"type": "Stmt::Program", | ||
"body": [ | ||
{ | ||
"type": "Stmt::Expression", | ||
"expr": { | ||
"type": "Expr::Select", | ||
"value": { | ||
"core": { | ||
"projection": [{ | ||
"collection": null | ||
}] | ||
}, | ||
"limit": null, | ||
"order_by": null | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
|
||
collection: { | ||
"SELECT users.* from users;" => { | ||
"type": "Stmt::Program", | ||
"body": [ | ||
{ | ||
"type": "Stmt::Expression", | ||
"expr": { | ||
"type": "Expr::Select", | ||
"value": { | ||
"core": { | ||
"projection": [{ | ||
"collection": "users" | ||
}] | ||
}, | ||
"limit": null, | ||
"order_by": null | ||
} | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
mixed_0: { | ||
"SELECT id, users.name as username from users;" => { | ||
"type": "Stmt::Program", | ||
"body": [ | ||
{ | ||
"type": "Stmt::Expression", | ||
"expr": { | ||
"type": "Expr::Select", | ||
"value": { | ||
"core": { | ||
"projection": [{ | ||
"expr": { | ||
"type": "Expr::Variable", | ||
"name": "id" | ||
}, | ||
"alias": null | ||
}, | ||
{ | ||
"expr": { | ||
"type": "Expr::Get", | ||
"object": { | ||
"type": "Expr::Variable", | ||
"name": "users" | ||
}, | ||
"name": "name" | ||
}, | ||
"alias": "username" | ||
}] | ||
}, | ||
"limit": null, | ||
"order_by": null | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |