-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1958 from fermyon/final-wit-changes
Potentially final wit changes for 2.0.0
- Loading branch information
Showing
32 changed files
with
406 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
use super::*; | ||
|
||
mod rdbms_types { | ||
use super::*; | ||
|
||
impl From<v2::rdbms_types::Column> for v1::rdbms_types::Column { | ||
fn from(value: v2::rdbms_types::Column) -> Self { | ||
v1::rdbms_types::Column { | ||
name: value.name, | ||
data_type: value.data_type.into(), | ||
} | ||
} | ||
} | ||
|
||
impl From<v2::rdbms_types::DbValue> for v1::rdbms_types::DbValue { | ||
fn from(value: v2::rdbms_types::DbValue) -> v1::rdbms_types::DbValue { | ||
match value { | ||
v2::rdbms_types::DbValue::Boolean(b) => v1::rdbms_types::DbValue::Boolean(b), | ||
v2::rdbms_types::DbValue::Int8(i) => v1::rdbms_types::DbValue::Int8(i), | ||
v2::rdbms_types::DbValue::Int16(i) => v1::rdbms_types::DbValue::Int16(i), | ||
v2::rdbms_types::DbValue::Int32(i) => v1::rdbms_types::DbValue::Int32(i), | ||
v2::rdbms_types::DbValue::Int64(i) => v1::rdbms_types::DbValue::Int64(i), | ||
v2::rdbms_types::DbValue::Uint8(j) => v1::rdbms_types::DbValue::Uint8(j), | ||
v2::rdbms_types::DbValue::Uint16(u) => v1::rdbms_types::DbValue::Uint16(u), | ||
v2::rdbms_types::DbValue::Uint32(u) => v1::rdbms_types::DbValue::Uint32(u), | ||
v2::rdbms_types::DbValue::Uint64(u) => v1::rdbms_types::DbValue::Uint64(u), | ||
v2::rdbms_types::DbValue::Floating32(r) => v1::rdbms_types::DbValue::Floating32(r), | ||
v2::rdbms_types::DbValue::Floating64(r) => v1::rdbms_types::DbValue::Floating64(r), | ||
v2::rdbms_types::DbValue::Str(s) => v1::rdbms_types::DbValue::Str(s), | ||
v2::rdbms_types::DbValue::Binary(b) => v1::rdbms_types::DbValue::Binary(b), | ||
v2::rdbms_types::DbValue::DbNull => v1::rdbms_types::DbValue::DbNull, | ||
v2::rdbms_types::DbValue::Unsupported => v1::rdbms_types::DbValue::Unsupported, | ||
} | ||
} | ||
} | ||
|
||
impl From<v2::rdbms_types::DbDataType> for v1::rdbms_types::DbDataType { | ||
fn from(value: v2::rdbms_types::DbDataType) -> v1::rdbms_types::DbDataType { | ||
match value { | ||
v2::rdbms_types::DbDataType::Boolean => v1::rdbms_types::DbDataType::Boolean, | ||
v2::rdbms_types::DbDataType::Int8 => v1::rdbms_types::DbDataType::Int8, | ||
v2::rdbms_types::DbDataType::Int16 => v1::rdbms_types::DbDataType::Int16, | ||
v2::rdbms_types::DbDataType::Int32 => v1::rdbms_types::DbDataType::Int32, | ||
v2::rdbms_types::DbDataType::Int64 => v1::rdbms_types::DbDataType::Int64, | ||
v2::rdbms_types::DbDataType::Uint8 => v1::rdbms_types::DbDataType::Uint8, | ||
v2::rdbms_types::DbDataType::Uint16 => v1::rdbms_types::DbDataType::Uint16, | ||
v2::rdbms_types::DbDataType::Uint32 => v1::rdbms_types::DbDataType::Uint32, | ||
v2::rdbms_types::DbDataType::Uint64 => v1::rdbms_types::DbDataType::Uint64, | ||
v2::rdbms_types::DbDataType::Floating32 => v1::rdbms_types::DbDataType::Floating32, | ||
v2::rdbms_types::DbDataType::Floating64 => v1::rdbms_types::DbDataType::Floating64, | ||
v2::rdbms_types::DbDataType::Str => v1::rdbms_types::DbDataType::Str, | ||
v2::rdbms_types::DbDataType::Binary => v1::rdbms_types::DbDataType::Binary, | ||
v2::rdbms_types::DbDataType::Other => v1::rdbms_types::DbDataType::Other, | ||
} | ||
} | ||
} | ||
|
||
impl From<v1::rdbms_types::ParameterValue> for v2::rdbms_types::ParameterValue { | ||
fn from(value: v1::rdbms_types::ParameterValue) -> v2::rdbms_types::ParameterValue { | ||
match value { | ||
v1::rdbms_types::ParameterValue::Boolean(b) => { | ||
v2::rdbms_types::ParameterValue::Boolean(b) | ||
} | ||
v1::rdbms_types::ParameterValue::Int8(i) => { | ||
v2::rdbms_types::ParameterValue::Int8(i) | ||
} | ||
v1::rdbms_types::ParameterValue::Int16(i) => { | ||
v2::rdbms_types::ParameterValue::Int16(i) | ||
} | ||
v1::rdbms_types::ParameterValue::Int32(i) => { | ||
v2::rdbms_types::ParameterValue::Int32(i) | ||
} | ||
v1::rdbms_types::ParameterValue::Int64(i) => { | ||
v2::rdbms_types::ParameterValue::Int64(i) | ||
} | ||
v1::rdbms_types::ParameterValue::Uint8(u) => { | ||
v2::rdbms_types::ParameterValue::Uint8(u) | ||
} | ||
v1::rdbms_types::ParameterValue::Uint16(u) => { | ||
v2::rdbms_types::ParameterValue::Uint16(u) | ||
} | ||
v1::rdbms_types::ParameterValue::Uint32(u) => { | ||
v2::rdbms_types::ParameterValue::Uint32(u) | ||
} | ||
v1::rdbms_types::ParameterValue::Uint64(u) => { | ||
v2::rdbms_types::ParameterValue::Uint64(u) | ||
} | ||
v1::rdbms_types::ParameterValue::Floating32(r) => { | ||
v2::rdbms_types::ParameterValue::Floating32(r) | ||
} | ||
v1::rdbms_types::ParameterValue::Floating64(r) => { | ||
v2::rdbms_types::ParameterValue::Floating64(r) | ||
} | ||
v1::rdbms_types::ParameterValue::Str(s) => v2::rdbms_types::ParameterValue::Str(s), | ||
v1::rdbms_types::ParameterValue::Binary(b) => { | ||
v2::rdbms_types::ParameterValue::Binary(b) | ||
} | ||
v1::rdbms_types::ParameterValue::DbNull => v2::rdbms_types::ParameterValue::DbNull, | ||
} | ||
} | ||
} | ||
|
||
impl From<v2::rdbms_types::Error> for v1::mysql::MysqlError { | ||
fn from(error: v2::rdbms_types::Error) -> v1::mysql::MysqlError { | ||
match error { | ||
v2::mysql::Error::ConnectionFailed(e) => v1::mysql::MysqlError::ConnectionFailed(e), | ||
v2::mysql::Error::BadParameter(e) => v1::mysql::MysqlError::BadParameter(e), | ||
v2::mysql::Error::QueryFailed(e) => v1::mysql::MysqlError::QueryFailed(e), | ||
v2::mysql::Error::ValueConversionFailed(e) => { | ||
v1::mysql::MysqlError::ValueConversionFailed(e) | ||
} | ||
v2::mysql::Error::Other(e) => v1::mysql::MysqlError::OtherError(e), | ||
} | ||
} | ||
} | ||
|
||
impl From<v2::rdbms_types::Error> for v1::postgres::PgError { | ||
fn from(error: v2::rdbms_types::Error) -> v1::postgres::PgError { | ||
match error { | ||
v2::mysql::Error::ConnectionFailed(e) => v1::postgres::PgError::ConnectionFailed(e), | ||
v2::mysql::Error::BadParameter(e) => v1::postgres::PgError::BadParameter(e), | ||
v2::mysql::Error::QueryFailed(e) => v1::postgres::PgError::QueryFailed(e), | ||
v2::mysql::Error::ValueConversionFailed(e) => { | ||
v1::postgres::PgError::ValueConversionFailed(e) | ||
} | ||
v2::mysql::Error::Other(e) => v1::postgres::PgError::OtherError(e), | ||
} | ||
} | ||
} | ||
} | ||
|
||
mod mysql { | ||
use super::*; | ||
impl From<v2::mysql::RowSet> for v1::mysql::RowSet { | ||
fn from(value: v2::mysql::RowSet) -> v1::mysql::RowSet { | ||
v1::mysql::RowSet { | ||
columns: value.columns.into_iter().map(Into::into).collect(), | ||
rows: value | ||
.rows | ||
.into_iter() | ||
.map(|r| r.into_iter().map(Into::into).collect()) | ||
.collect(), | ||
} | ||
} | ||
} | ||
} | ||
|
||
mod redis { | ||
use super::*; | ||
|
||
impl From<v1::redis::RedisParameter> for v2::redis::RedisParameter { | ||
fn from(value: v1::redis::RedisParameter) -> Self { | ||
match value { | ||
v1::redis::RedisParameter::Int64(i) => v2::redis::RedisParameter::Int64(i), | ||
v1::redis::RedisParameter::Binary(b) => v2::redis::RedisParameter::Binary(b), | ||
} | ||
} | ||
} | ||
|
||
impl From<v2::redis::RedisResult> for v1::redis::RedisResult { | ||
fn from(value: v2::redis::RedisResult) -> Self { | ||
match value { | ||
v2::redis::RedisResult::Nil => v1::redis::RedisResult::Nil, | ||
v2::redis::RedisResult::Status(s) => v1::redis::RedisResult::Status(s), | ||
v2::redis::RedisResult::Int64(i) => v1::redis::RedisResult::Int64(i), | ||
v2::redis::RedisResult::Binary(b) => v1::redis::RedisResult::Binary(b), | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,5 @@ wasmtime::component::bindgen!({ | |
|
||
pub use fermyon::spin as v1; | ||
pub use fermyon::spin2_0_0 as v2; | ||
|
||
mod conversions; |
Oops, something went wrong.