File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -289,6 +289,28 @@ impl LogicalTypeHandle {
289289 } ;
290290 unsafe { Self :: new ( c_logical_type) }
291291 }
292+
293+ /// Alias of the logical type.
294+ pub fn get_alias ( & self ) -> Option < String > {
295+ unsafe {
296+ let alias_ptr = duckdb_logical_type_get_alias ( self . ptr ) ;
297+ if alias_ptr. is_null ( ) {
298+ None
299+ } else {
300+ let c_str = CString :: from_raw ( alias_ptr) ;
301+ let alias = c_str. to_str ( ) . unwrap ( ) ;
302+ Some ( alias. to_string ( ) )
303+ }
304+ }
305+ }
306+
307+ /// Set the alias of the logical type.
308+ pub fn set_alias ( & self , alias : & str ) -> ( ) {
309+ unsafe {
310+ let alias = CString :: new ( alias) . unwrap ( ) ;
311+ duckdb_logical_type_set_alias ( self . ptr , alias. as_ptr ( ) ) ;
312+ }
313+ }
292314}
293315
294316#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments