-
Notifications
You must be signed in to change notification settings - Fork 235
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
feat: add introspectSql command #4941
Merged
Merged
Changes from 29 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
35d8018
wip: vertical slice of introspect sql
Weakky 004522f
fix rebase
Weakky 61b04c8
add sqlite support (unnamed & unknom type for params)
Weakky 68e7669
add tests
Weakky 07f1d43
enhance tests
Weakky c06be19
rename internals
Weakky ac7c981
add sqlite support in quaint as well
Weakky aed1fd3
resolve enum names for pg
Weakky d27bf46
add enum test
Weakky cc3e9ea
add basic sqlite tests
Weakky c7a13be
split tests in different files
Weakky 0a2fc83
add rpc command
Weakky 94c2717
add native types tests
Weakky 8619e38
add few more tests
Weakky dfed2f0
fix mysql56 test
Weakky 741b5e7
fix crdb tests
Weakky 13f1cd2
refactor & fix tests
Weakky b2b600c
add source to output
Weakky 664740d
clippy fix
Weakky 239c912
add more mysql & sqlite tests
Weakky 23edba6
add more sqlite tests
Weakky b9fe531
add support for magic comments
Weakky c285da0
fix fmt
Weakky 40f60b4
fix tests
Weakky 0fa5f05
make documentation optional
Weakky 93ecf00
cleanup
Weakky 6e50b79
exclude vitess (overlaps with mysql8 but returns different results)
Weakky 9d9441c
make mssql implementation explicitly unimplemented
Weakky b067a86
fixes unit test
Weakky 921f6bc
small cleanup
Weakky 405f504
add pg/crdb insert test back
Weakky dc10635
review cleanup
Weakky 59e50b6
make mysql 5.6 & 5.7 return unknown for params
Weakky 4dcdf8b
add typedSql preview feature
Weakky e3dc131
make typedsql feat hidden
Weakky 9312993
add unhandled multi-line comment test
Weakky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,73 @@ | ||
use std::borrow::Cow; | ||
|
||
use super::ColumnType; | ||
|
||
#[derive(Debug)] | ||
pub struct ParsedRawQuery { | ||
pub parameters: Vec<ParsedRawParameter>, | ||
pub columns: Vec<ParsedRawColumn>, | ||
} | ||
|
||
#[derive(Debug)] | ||
pub struct ParsedRawParameter { | ||
pub name: String, | ||
pub typ: ColumnType, | ||
pub enum_name: Option<String>, | ||
} | ||
|
||
#[derive(Debug)] | ||
pub struct ParsedRawColumn { | ||
pub name: String, | ||
pub typ: ColumnType, | ||
pub enum_name: Option<String>, | ||
} | ||
|
||
impl ParsedRawParameter { | ||
pub fn new_named<'a>(name: impl Into<Cow<'a, str>>, typ: impl Into<ColumnType>) -> Self { | ||
let name: Cow<'_, str> = name.into(); | ||
|
||
Self { | ||
name: name.into_owned(), | ||
typ: typ.into(), | ||
enum_name: None, | ||
} | ||
} | ||
|
||
pub fn new_unnamed(idx: usize, typ: impl Into<ColumnType>) -> Self { | ||
Self { | ||
name: format!("_{idx}"), | ||
typ: typ.into(), | ||
enum_name: None, | ||
} | ||
} | ||
|
||
pub fn with_enum_name(mut self, enum_name: Option<String>) -> Self { | ||
self.enum_name = enum_name; | ||
self | ||
} | ||
} | ||
|
||
impl ParsedRawColumn { | ||
pub fn new_named<'a>(name: impl Into<Cow<'a, str>>, typ: impl Into<ColumnType>) -> Self { | ||
let name: Cow<'_, str> = name.into(); | ||
|
||
Self { | ||
name: name.into_owned(), | ||
typ: typ.into(), | ||
enum_name: None, | ||
} | ||
} | ||
|
||
pub fn new_unnamed(idx: usize, typ: impl Into<ColumnType>) -> Self { | ||
Self { | ||
name: format!("_{idx}"), | ||
typ: typ.into(), | ||
enum_name: None, | ||
} | ||
} | ||
|
||
pub fn with_enum_name(mut self, enum_name: Option<String>) -> Self { | ||
self.enum_name = enum_name; | ||
self | ||
} | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mapping was incorrect. I spotted it as we're using this function for native type tests