Skip to content

Commit

Permalink
fix: mysql fixes in WASM plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
worstell committed Jan 7, 2025
1 parent bb68bd8 commit d22c2a5
Show file tree
Hide file tree
Showing 17 changed files with 2,111 additions and 78 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
- name: Build Cache
uses: ./.github/actions/build-cache
- name: Test WASM
run: cd sqlc-gen-ftl && cargo test --features ci --test sqlc_gen_ftl_test -- --nocapture
run: just test-sqlc-gen-ftl
- name: Check for uncommitted changes
run: |
if [[ -n $(git status -s) ]]; then
Expand Down
3 changes: 3 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ build-sqlc-gen-ftl: build-rust-protos
"cd sqlc-gen-ftl && \
cargo build --target wasm32-wasip1 --release"

test-sqlc-gen-ftl:
@cargo test --manifest-path sqlc-gen-ftl/Cargo.toml --features ci --test sqlc_gen_ftl_test -- --nocapture

# Generate Rust protos
build-rust-protos:
@mk sqlc-gen-ftl/src/protos : backend/protos -- \
Expand Down
174 changes: 174 additions & 0 deletions backend/protos/src/protos/xyz.block.ftl.console.v1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
// @generated
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Config {
#[prost(message, optional, tag="1")]
pub config: ::core::option::Option<super::super::schema::v1::Config>,
#[prost(message, repeated, tag="2")]
pub references: ::prost::alloc::vec::Vec<super::super::schema::v1::Ref>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Data {
#[prost(message, optional, tag="1")]
pub data: ::core::option::Option<super::super::schema::v1::Data>,
#[prost(string, tag="2")]
pub schema: ::prost::alloc::string::String,
#[prost(message, repeated, tag="3")]
pub references: ::prost::alloc::vec::Vec<super::super::schema::v1::Ref>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Database {
#[prost(message, optional, tag="1")]
pub database: ::core::option::Option<super::super::schema::v1::Database>,
#[prost(message, repeated, tag="2")]
pub references: ::prost::alloc::vec::Vec<super::super::schema::v1::Ref>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Enum {
#[prost(message, optional, tag="1")]
pub r#enum: ::core::option::Option<super::super::schema::v1::Enum>,
#[prost(message, repeated, tag="2")]
pub references: ::prost::alloc::vec::Vec<super::super::schema::v1::Ref>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Topic {
#[prost(message, optional, tag="1")]
pub topic: ::core::option::Option<super::super::schema::v1::Topic>,
#[prost(message, repeated, tag="2")]
pub references: ::prost::alloc::vec::Vec<super::super::schema::v1::Ref>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TypeAlias {
#[prost(message, optional, tag="1")]
pub typealias: ::core::option::Option<super::super::schema::v1::TypeAlias>,
#[prost(message, repeated, tag="2")]
pub references: ::prost::alloc::vec::Vec<super::super::schema::v1::Ref>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Secret {
#[prost(message, optional, tag="1")]
pub secret: ::core::option::Option<super::super::schema::v1::Secret>,
#[prost(message, repeated, tag="2")]
pub references: ::prost::alloc::vec::Vec<super::super::schema::v1::Ref>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Verb {
#[prost(message, optional, tag="1")]
pub verb: ::core::option::Option<super::super::schema::v1::Verb>,
#[prost(string, tag="2")]
pub schema: ::prost::alloc::string::String,
#[prost(string, tag="3")]
pub json_request_schema: ::prost::alloc::string::String,
#[prost(message, repeated, tag="4")]
pub references: ::prost::alloc::vec::Vec<super::super::schema::v1::Ref>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Module {
#[prost(string, tag="1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag="2")]
pub deployment_key: ::prost::alloc::string::String,
#[prost(string, tag="3")]
pub language: ::prost::alloc::string::String,
#[prost(string, tag="4")]
pub schema: ::prost::alloc::string::String,
#[prost(message, repeated, tag="5")]
pub verbs: ::prost::alloc::vec::Vec<Verb>,
#[prost(message, repeated, tag="6")]
pub data: ::prost::alloc::vec::Vec<Data>,
#[prost(message, repeated, tag="7")]
pub secrets: ::prost::alloc::vec::Vec<Secret>,
#[prost(message, repeated, tag="8")]
pub configs: ::prost::alloc::vec::Vec<Config>,
#[prost(message, repeated, tag="9")]
pub databases: ::prost::alloc::vec::Vec<Database>,
#[prost(message, repeated, tag="10")]
pub enums: ::prost::alloc::vec::Vec<Enum>,
#[prost(message, repeated, tag="11")]
pub topics: ::prost::alloc::vec::Vec<Topic>,
#[prost(message, repeated, tag="12")]
pub typealiases: ::prost::alloc::vec::Vec<TypeAlias>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TopologyGroup {
#[prost(string, repeated, tag="1")]
pub modules: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Topology {
#[prost(message, repeated, tag="1")]
pub levels: ::prost::alloc::vec::Vec<TopologyGroup>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetModulesRequest {
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetModulesResponse {
#[prost(message, repeated, tag="1")]
pub modules: ::prost::alloc::vec::Vec<Module>,
#[prost(message, optional, tag="2")]
pub topology: ::core::option::Option<Topology>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct StreamModulesRequest {
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StreamModulesResponse {
#[prost(message, repeated, tag="1")]
pub modules: ::prost::alloc::vec::Vec<Module>,
#[prost(message, optional, tag="2")]
pub topology: ::core::option::Option<Topology>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetConfigRequest {
#[prost(string, tag="1")]
pub name: ::prost::alloc::string::String,
#[prost(string, optional, tag="2")]
pub module: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetConfigResponse {
#[prost(bytes="bytes", tag="1")]
pub value: ::prost::bytes::Bytes,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetConfigRequest {
#[prost(string, tag="1")]
pub name: ::prost::alloc::string::String,
#[prost(string, optional, tag="2")]
pub module: ::core::option::Option<::prost::alloc::string::String>,
#[prost(bytes="bytes", tag="3")]
pub value: ::prost::bytes::Bytes,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetConfigResponse {
#[prost(bytes="bytes", tag="1")]
pub value: ::prost::bytes::Bytes,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetSecretRequest {
#[prost(string, tag="1")]
pub name: ::prost::alloc::string::String,
#[prost(string, optional, tag="2")]
pub module: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetSecretResponse {
#[prost(bytes="bytes", tag="1")]
pub value: ::prost::bytes::Bytes,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetSecretRequest {
#[prost(string, tag="1")]
pub name: ::prost::alloc::string::String,
#[prost(string, optional, tag="2")]
pub module: ::core::option::Option<::prost::alloc::string::String>,
#[prost(bytes="bytes", tag="3")]
pub value: ::prost::bytes::Bytes,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetSecretResponse {
#[prost(bytes="bytes", tag="1")]
pub value: ::prost::bytes::Bytes,
}
// @@protoc_insertion_point(module)
71 changes: 71 additions & 0 deletions backend/protos/src/protos/xyz.block.ftl.deployment.v1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// @generated
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetDeploymentContextRequest {
#[prost(string, tag="1")]
pub deployment: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetDeploymentContextResponse {
#[prost(string, tag="1")]
pub module: ::prost::alloc::string::String,
#[prost(string, tag="2")]
pub deployment: ::prost::alloc::string::String,
#[prost(map="string, bytes", tag="3")]
pub configs: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::bytes::Bytes>,
#[prost(map="string, bytes", tag="4")]
pub secrets: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::bytes::Bytes>,
#[prost(message, repeated, tag="5")]
pub databases: ::prost::alloc::vec::Vec<get_deployment_context_response::Dsn>,
#[prost(message, repeated, tag="6")]
pub routes: ::prost::alloc::vec::Vec<get_deployment_context_response::Route>,
}
/// Nested message and enum types in `GetDeploymentContextResponse`.
pub mod get_deployment_context_response {
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Dsn {
#[prost(string, tag="1")]
pub name: ::prost::alloc::string::String,
#[prost(enumeration="DbType", tag="2")]
pub r#type: i32,
#[prost(string, tag="3")]
pub dsn: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Route {
#[prost(string, tag="1")]
pub deployment: ::prost::alloc::string::String,
#[prost(string, tag="2")]
pub uri: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum DbType {
Unspecified = 0,
Postgres = 1,
Mysql = 2,
}
impl DbType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "DB_TYPE_UNSPECIFIED",
Self::Postgres => "DB_TYPE_POSTGRES",
Self::Mysql => "DB_TYPE_MYSQL",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"DB_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"DB_TYPE_POSTGRES" => Some(Self::Postgres),
"DB_TYPE_MYSQL" => Some(Self::Mysql),
_ => None,
}
}
}
}
// @@protoc_insertion_point(module)
Loading

0 comments on commit d22c2a5

Please sign in to comment.