@@ -33,9 +33,6 @@ pub enum CqlType {
3333 Uuid = 0x000C ,
3434 Varint = 0x000E ,
3535 Custom = 0x0000 ,
36- // This type is not part of the CQL protocol.
37- // TODO: Remove it in favour of better handling of unprovided type information.
38- Unprovided = 0x0070 ,
3936}
4037
4138/// This struct is part of the `ComplexType` struct and is used to store information about UDTs.
@@ -77,30 +74,6 @@ impl ComplexType {
7774 self . inner_types . clone ( )
7875 }
7976
80- /// Create a new copy of the ComplexType, with first support type set to the provided type and the same base type
81- ///
82- /// Intended for filling types of the list / set values in case no support type was initially provided
83- #[ napi]
84- pub fn remap_list_support_type ( & self , new_subtype : & ComplexType ) -> ComplexType {
85- ComplexType :: one_support ( self . base_type , Some ( new_subtype. clone ( ) ) )
86- }
87-
88- /// Create a new copy of the ComplexType, with first and second support type set to the provided types and the same base type
89- ///
90- /// Intended for filling types of the map keys and value in case no support types were initially provided
91- #[ napi]
92- pub fn remap_map_support_type (
93- & self ,
94- key_new_subtype : & ComplexType ,
95- val_new_subtype : & ComplexType ,
96- ) -> ComplexType {
97- ComplexType :: two_support (
98- self . base_type ,
99- Some ( key_new_subtype. clone ( ) ) ,
100- Some ( val_new_subtype. clone ( ) ) ,
101- )
102- }
103-
10477 #[ napi]
10578 pub fn get_udt_field_names ( & self ) -> Option < Vec < String > > {
10679 // Batch query to NAPI minimizes number of calls
@@ -123,65 +96,6 @@ impl ComplexType {
12396 . map ( |metadata| metadata. name . clone ( ) )
12497 }
12598
126- /// Create a new ComplexType for tuple with provided inner types.
127- #[ napi]
128- pub fn remap_tuple_support_type ( new_subtypes : Vec < Option < & ComplexType > > ) -> ComplexType {
129- ComplexType :: from_tuple (
130- new_subtypes
131- . into_iter ( )
132- // HACK:
133- // There is a chance, user doesn't provide a type for some tuple value.
134- // If this value is null or unset, we can still correctly handle that case.
135- // For this reason we set here Unprovided type, a type that will never be used in request.
136- // If we encounter Unprovided in parsing value, this means that insufficient type information was provided.
137- //
138- // This will be fixed at a later time, as it requires more investigation into how tuple works.
139- . map ( |e| {
140- e. unwrap_or ( & ComplexType :: simple_type ( CqlType :: Unprovided ) )
141- . clone ( )
142- } )
143- . collect ( ) ,
144- )
145- }
146-
147- /// Create a new ComplexType for UDT with provided inner types and field names. Used in JS part of the driver during type guessing.
148- #[ napi]
149- pub fn new_udt_type (
150- new_subtypes : Vec < Option < & ComplexType > > ,
151- field_names : Vec < String > ,
152- keyspace : String ,
153- name : String ,
154- ) -> ComplexType {
155- ComplexType {
156- base_type : CqlType :: UserDefinedType ,
157- support_type_1 : None ,
158- support_type_2 : None ,
159- inner_types : new_subtypes
160- . into_iter ( )
161- // HACK:
162- // There is a chance, user doesn't provide a type for some UDT value.
163- // If this value is null or unset, we can still correctly handle that case.
164- // For this reason we set here Unprovided type, a type that will never be used in request.
165- // If we encounter Unprovided in parsing value, this means, that unsufficient type information was provided.
166- //
167- // This will be fixed at a later time, as it requires more investigation into how UDT works.
168- . map ( |e| {
169- e. cloned ( )
170- . unwrap_or_else ( || ComplexType :: simple_type ( CqlType :: Unprovided ) )
171- } )
172- . collect ( ) ,
173- udt_metadata : Some ( UdtMetadata {
174- keyspace,
175- name,
176- field_names,
177- } ) ,
178- }
179- }
180-
181- #[ napi]
182- pub fn get_udt_names ( & self ) -> Option < Vec < String > > {
183- self . udt_metadata . as_ref ( ) . map ( |e| e. field_names . clone ( ) )
184- }
18599}
186100
187101impl ComplexType {
0 commit comments