Macro connectorx::impl_transport
source · macro_rules! impl_transport { ( name = $TP:ty, error = $ET:ty, systems = $TSS:tt => $TSD:tt, route = $S:ty => $D:ty, mappings = { $( { $($TOKENS:tt)+ } )* } ) => { ... }; (@transport $TP:ty, $ET:ty [$TSS:tt, $TSD:tt] [$S:ty, $D:ty] $([ $($TOKENS:tt)+ ])*) => { ... }; (@cvtts [$TSS:tt, $TSD:tt] $( [$V1:tt [$T1:ty] => $V2:tt [$T2:ty] | conversion $HOW:ident] )*) => { ... }; (@process [$TSS:tt, $TSD:tt] $([ $V1:tt [$T1:ty] => $V2:tt [$T2:ty] | conversion $HOW:ident ])*) => { ... }; (@processor [$TSS:tt, $TSD:tt] $([ $V1:tt [$T1:ty] => $V2:tt [$T2:ty] | conversion $HOW:ident ])*, $([ $($TOKENS:tt)+ ])*) => { ... }; (@process_func_branch $OPT:ident [ $V1:tt [&$L1:lifetime $T1:ty] => $V2:tt [&$L2:lifetime $T2:ty] | conversion $HOW:ident ]) => { ... }; (@process_func_branch $OPT:ident [ $V1:tt [$T1:ty] => $V2:tt [&$L2:lifetime $T2:ty] | conversion $HOW:ident ]) => { ... }; (@process_func_branch $OPT:ident [ $V1:tt [&$L1:lifetime $T1:ty] => $V2:tt [$T2:ty] | conversion $HOW:ident ]) => { ... }; (@process_func_branch $OPT:ident [ $V1:tt [$T1:ty] => $V2:tt [$T2:ty] | conversion $HOW:ident ]) => { ... }; (@process_func_branch true $T1:ty, $T2:ty) => { ... }; (@process_func_branch false $T1:ty, $T2:ty) => { ... }; (@cvt $TP:ty, $V1:tt [$T1:ty] => $V2:tt [$T2:ty] | conversion $HOW:ident) => { ... }; (@cvt auto $TP:ty, $T1:ty, $T2:ty) => { ... }; (@cvt auto_vec $TP:ty, $T1:ty, $T2:ty) => { ... }; (@cvt owned $TP:ty, $T1:ty, $T2:ty) => { ... }; (@cvt option $TP:ty, $T1:ty, $T2:ty) => { ... }; (@cvt none $TP:ty, $T1:ty, $T2:ty) => { ... }; }
Expand description
A macro to help define a Transport.
§Example Usage
ⓘ
impl_transport!(
name = MsSQLArrowTransport,
error = MsSQLArrowTransportError,
systems = MsSQLTypeSystem => ArrowTypeSystem,
route = MsSQLSource => ArrowDestination,
mappings = {
{ Tinyint[u8] => Int32[i32] | conversion auto }
{ Smallint[i16] => Int32[i32] | conversion auto }
{ Int[i32] => Int32[i32] | conversion auto }
{ Bigint[i64] => Int64[i64] | conversion auto }
{ Intn[IntN] => Int64[i64] | conversion option }
{ Float24[f32] => Float32[f32] | conversion auto }
{ Float53[f64] => Float64[f64] | conversion auto }
{ Floatn[FloatN] => Float64[f64] | conversion option }
{ Bit[bool] => Boolean[bool] | conversion auto }
{ Nvarchar[&'r str] => LargeUtf8[String] | conversion owned }
{ Varchar[&'r str] => LargeUtf8[String] | conversion none }
{ Nchar[&'r str] => LargeUtf8[String] | conversion none }
{ Char[&'r str] => LargeUtf8[String] | conversion none }
{ Text[&'r str] => LargeUtf8[String] | conversion none }
{ Ntext[&'r str] => LargeUtf8[String] | conversion none }
{ Binary[&'r [u8]] => LargeBinary[Vec<u8>] | conversion owned }
{ Varbinary[&'r [u8]] => LargeBinary[Vec<u8>] | conversion none }
{ Image[&'r [u8]] => LargeBinary[Vec<u8>] | conversion none }
{ Numeric[Decimal] => Float64[f64] | conversion option }
{ Decimal[Decimal] => Float64[f64] | conversion none }
{ Datetime[NaiveDateTime] => Date64[NaiveDateTime] | conversion auto }
{ Datetime2[NaiveDateTime] => Date64[NaiveDateTime] | conversion none }
{ Smalldatetime[NaiveDateTime] => Date64[NaiveDateTime] | conversion none }
{ Date[NaiveDate] => Date32[NaiveDate] | conversion auto }
{ Datetimeoffset[DateTime<Utc>] => DateTimeTz[DateTime<Utc>] | conversion auto }
{ Uniqueidentifier[Uuid] => LargeUtf8[String] | conversion option }
}
);
This implements a Transport
called MsSQLArrowTransport
that can convert types from MsSQL to Arrow.