@@ -21,12 +21,12 @@ static TS_QUERY: LazyLock<tree_sitter::Query> = LazyLock::new(|| {
2121} ) ;
2222
2323#[ derive( Debug ) ]
24- pub struct ColumnMatch < ' a > {
24+ pub struct SelectColumnMatch < ' a > {
2525 pub ( crate ) alias : Option < tree_sitter:: Node < ' a > > ,
2626 pub ( crate ) column : tree_sitter:: Node < ' a > ,
2727}
2828
29- impl ColumnMatch < ' _ > {
29+ impl SelectColumnMatch < ' _ > {
3030 pub fn get_alias ( & self , sql : & str ) -> Option < String > {
3131 let str = self
3232 . alias
@@ -45,24 +45,24 @@ impl ColumnMatch<'_> {
4545 }
4646}
4747
48- impl < ' a > TryFrom < & ' a QueryResult < ' a > > for & ' a ColumnMatch < ' a > {
48+ impl < ' a > TryFrom < & ' a QueryResult < ' a > > for & ' a SelectColumnMatch < ' a > {
4949 type Error = String ;
5050
5151 fn try_from ( q : & ' a QueryResult < ' a > ) -> Result < Self , Self :: Error > {
5252 match q {
53- QueryResult :: Column ( c) => Ok ( c) ,
53+ QueryResult :: SelectClauseColumns ( c) => Ok ( c) ,
5454
5555 #[ allow( unreachable_patterns) ]
5656 _ => Err ( "Invalid QueryResult type" . into ( ) ) ,
5757 }
5858 }
5959}
6060
61- impl < ' a > QueryTryFrom < ' a > for ColumnMatch < ' a > {
62- type Ref = & ' a ColumnMatch < ' a > ;
61+ impl < ' a > QueryTryFrom < ' a > for SelectColumnMatch < ' a > {
62+ type Ref = & ' a SelectColumnMatch < ' a > ;
6363}
6464
65- impl < ' a > Query < ' a > for ColumnMatch < ' a > {
65+ impl < ' a > Query < ' a > for SelectColumnMatch < ' a > {
6666 fn execute ( root_node : tree_sitter:: Node < ' a > , stmt : & ' a str ) -> Vec < crate :: QueryResult < ' a > > {
6767 let mut cursor = tree_sitter:: QueryCursor :: new ( ) ;
6868
@@ -73,7 +73,7 @@ impl<'a> Query<'a> for ColumnMatch<'a> {
7373 for m in matches {
7474 if m. captures . len ( ) == 1 {
7575 let capture = m. captures [ 0 ] . node ;
76- to_return. push ( QueryResult :: Column ( ColumnMatch {
76+ to_return. push ( QueryResult :: SelectClauseColumns ( SelectColumnMatch {
7777 alias : None ,
7878 column : capture,
7979 } ) ) ;
@@ -83,7 +83,7 @@ impl<'a> Query<'a> for ColumnMatch<'a> {
8383 let alias = m. captures [ 0 ] . node ;
8484 let column = m. captures [ 1 ] . node ;
8585
86- to_return. push ( QueryResult :: Column ( ColumnMatch {
86+ to_return. push ( QueryResult :: SelectClauseColumns ( SelectColumnMatch {
8787 alias : Some ( alias) ,
8888 column,
8989 } ) ) ;
@@ -98,7 +98,7 @@ impl<'a> Query<'a> for ColumnMatch<'a> {
9898mod tests {
9999 use crate :: TreeSitterQueriesExecutor ;
100100
101- use super :: ColumnMatch ;
101+ use super :: SelectColumnMatch ;
102102
103103 #[ test]
104104 fn finds_all_columns ( ) {
@@ -111,9 +111,9 @@ mod tests {
111111
112112 let mut executor = TreeSitterQueriesExecutor :: new ( tree. root_node ( ) , sql) ;
113113
114- executor. add_query_results :: < ColumnMatch > ( ) ;
114+ executor. add_query_results :: < SelectColumnMatch > ( ) ;
115115
116- let results: Vec < & ColumnMatch > = executor
116+ let results: Vec < & SelectColumnMatch > = executor
117117 . get_iter ( None )
118118 . filter_map ( |q| q. try_into ( ) . ok ( ) )
119119 . collect ( ) ;
150150
151151 let mut executor = TreeSitterQueriesExecutor :: new ( tree. root_node ( ) , sql) ;
152152
153- executor. add_query_results :: < ColumnMatch > ( ) ;
153+ executor. add_query_results :: < SelectColumnMatch > ( ) ;
154154
155- let results: Vec < & ColumnMatch > = executor
155+ let results: Vec < & SelectColumnMatch > = executor
156156 . get_iter ( None )
157157 . filter_map ( |q| q. try_into ( ) . ok ( ) )
158158 . collect ( ) ;
0 commit comments