pull out args wip

This commit is contained in:
Kasper Juul Hermansen 2023-02-11 14:38:58 +01:00
parent 04526c052b
commit c4edd29f50
Signed by: kjuulh
GPG Key ID: 0F95C140730F2F23
3 changed files with 12 additions and 12 deletions

View File

@ -39,7 +39,17 @@ pub fn render_fields(fields: &Vec<FullTypeFields>) -> eyre::Result<Option<rust::
pub fn $name( pub fn $name(
&self, &self,
$(if let Some(args) = args.as_ref() => $(&args.args)) $(if let Some(args) = args.as_ref() => $(&args.args))
) -> $output { ) -> $(&output) {
let query = self.selection.select("$(field.name.as_ref())");
let query = query.arg("args", args).unwrap();
$output {
conn: self.conn.clone(),
proc: self.proc.clone(),
selection: query,
}
todo!() todo!()
} }
}); });

View File

@ -20,7 +20,7 @@ impl Handler for Input {
.ok_or(eyre::anyhow!("could not find name"))?; .ok_or(eyre::anyhow!("could not find name"))?;
let description = render_description(t); let description = render_description(t);
let input = rust::import("dagger_core", "Input"); //let input = rust::import("dagger_core", "Input");
let fields = match t.input_fields.as_ref() { let fields = match t.input_fields.as_ref() {
Some(i) => render_input_fields(i)?, Some(i) => render_input_fields(i)?,
@ -32,8 +32,6 @@ impl Handler for Input {
pub struct $name { pub struct $name {
$(if fields.is_some() => $fields) $(if fields.is_some() => $fields)
} }
impl $input for $name {}
}; };
Ok(out) Ok(out)

View File

@ -6,14 +6,6 @@ use crate::predicates::{
is_custom_scalar_type_ref, is_list_type, is_required_type_ref, is_scalar_type_ref, is_custom_scalar_type_ref, is_list_type, is_required_type_ref, is_scalar_type_ref,
}; };
//fn optional(t: rust::Tokens) -> impl FormatInto<Rust> {
// quote_fn! {"Option<$[const](t)>"}
//}
//
//fn required(t: rust::Tokens) -> impl FormatInto<Rust> {
// quote_fn! {"$[const](t)"}
//}
pub fn render_type_ref(inner: &TypeRef) -> eyre::Result<rust::Tokens> { pub fn render_type_ref(inner: &TypeRef) -> eyre::Result<rust::Tokens> {
let extract_of_type = |t: &TypeRef| -> Option<TypeRef> { let extract_of_type = |t: &TypeRef| -> Option<TypeRef> {
return t.clone().of_type.map(|t| *t); return t.clone().of_type.map(|t| *t);