feat: extract client

This commit is contained in:
2023-03-18 21:30:25 +01:00
parent 384294b390
commit ab6141ffb4
10 changed files with 242 additions and 63 deletions

View File

@@ -247,7 +247,7 @@ fn render_execution(funcs: &CommonFunctions, field: &FullTypeFields) -> rust::To
return $(output_type) {
proc: self.proc.clone(),
selection: query,
conn: self.conn.clone(),
graphql_client: self.graphql_client.clone(),
}
};
}
@@ -273,7 +273,7 @@ fn render_execution(funcs: &CommonFunctions, field: &FullTypeFields) -> rust::To
return vec![$(output_type) {
proc: self.proc.clone(),
selection: query,
conn: self.conn.clone(),
graphql_client: self.graphql_client.clone(),
}]
};
}

View File

@@ -12,15 +12,15 @@ use crate::utility::OptionExt;
pub fn render_object(funcs: &CommonFunctions, t: &FullType) -> eyre::Result<rust::Tokens> {
let selection = rust::import("crate::querybuilder", "Selection");
let child = rust::import("tokio::process", "Child");
let conn = rust::import("dagger_core::connect_params", "ConnectParams");
let graphql_client = rust::import("dagger_core::graphql_client", "DynGraphQLClient");
let arc = rust::import("std::sync", "Arc");
Ok(quote! {
#[derive(Debug, Clone)]
#[derive(Clone)]
pub struct $(t.name.pipe(|s| format_name(s))) {
pub proc: $arc<$child>,
pub selection: $selection,
pub conn: $conn,
pub graphql_client: $graphql_client
}
$(t.fields.pipe(|f| render_optional_args(funcs, f)))