use juniper::{FieldError, FieldResult, Value};
#[derive(Clone)]
pub struct Subsystem;
type Context = kubos_service::Context<Subsystem>;
pub struct QueryRoot;
graphql_object!(QueryRoot: Context as "Query" |&self| {
field ping(fail = false: bool) -> FieldResult<String>
{
if fail {
Err(FieldError::new("Query failed", Value::null()))
} else {
Ok(String::from("query"))
}
}
});
pub struct MutationRoot;
graphql_object!(MutationRoot: Context as "Mutation" |&self| {
field ping() -> FieldResult<String>
{
Ok(String::from("mutation"))
}
});