@@ -24,11 +24,11 @@ use alloc::string::String;
2424#[ cfg( not( feature = "std" ) ) ]
2525use alloc:: vec:: Vec ;
2626use core:: fmt;
27- use core:: fmt:: Formatter ;
2827
2928#[ cfg( feature = "serde" ) ]
3029use serde:: { Deserialize , Serialize } ;
3130
31+ use crate :: ast:: helpers:: key_value_options:: KeyValueOptions ;
3232use crate :: ast:: { Ident , ObjectName } ;
3333#[ cfg( feature = "visitor" ) ]
3434use sqlparser_derive:: { Visit , VisitMut } ;
@@ -38,36 +38,10 @@ use sqlparser_derive::{Visit, VisitMut};
3838#[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
3939pub struct StageParamsObject {
4040 pub url : Option < String > ,
41- pub encryption : DataLoadingOptions ,
41+ pub encryption : KeyValueOptions ,
4242 pub endpoint : Option < String > ,
4343 pub storage_integration : Option < String > ,
44- pub credentials : DataLoadingOptions ,
45- }
46-
47- #[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
48- #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
49- #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
50- pub struct DataLoadingOptions {
51- pub options : Vec < DataLoadingOption > ,
52- }
53-
54- #[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
55- #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
56- #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
57- pub enum DataLoadingOptionType {
58- STRING ,
59- BOOLEAN ,
60- ENUM ,
61- NUMBER ,
62- }
63-
64- #[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
65- #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
66- #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
67- pub struct DataLoadingOption {
68- pub option_name : String ,
69- pub option_type : DataLoadingOptionType ,
70- pub value : String ,
44+ pub credentials : KeyValueOptions ,
7145}
7246
7347#[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
@@ -106,39 +80,6 @@ impl fmt::Display for StageParamsObject {
10680 }
10781}
10882
109- impl fmt:: Display for DataLoadingOptions {
110- fn fmt ( & self , f : & mut Formatter < ' _ > ) -> fmt:: Result {
111- if !self . options . is_empty ( ) {
112- let mut first = false ;
113- for option in & self . options {
114- if !first {
115- first = true ;
116- } else {
117- f. write_str ( " " ) ?;
118- }
119- write ! ( f, "{}" , option) ?;
120- }
121- }
122- Ok ( ( ) )
123- }
124- }
125-
126- impl fmt:: Display for DataLoadingOption {
127- fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
128- match self . option_type {
129- DataLoadingOptionType :: STRING => {
130- write ! ( f, "{}='{}'" , self . option_name, self . value) ?;
131- }
132- DataLoadingOptionType :: ENUM
133- | DataLoadingOptionType :: BOOLEAN
134- | DataLoadingOptionType :: NUMBER => {
135- write ! ( f, "{}={}" , self . option_name, self . value) ?;
136- }
137- }
138- Ok ( ( ) )
139- }
140- }
141-
14283impl fmt:: Display for StageLoadSelectItem {
14384 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
14485 if self . alias . is_some ( ) {
0 commit comments