Macro juniper::graphql_value
source · macro_rules! graphql_value {
([ $($arg:tt),* $(,)* ]) => { ... };
({ $($key:tt : $val:tt ),* $(,)* }) => { ... };
(None) => { ... };
($e:expr) => { ... };
}
Expand description
Construct JSON-like values by using JSON syntax
This macro can be used to create Value
instances using a JSON syntax.
Value objects are used mostly when creating custom errors from fields.
Here are some examples; the resulting JSON will look just like what you passed in.
#[macro_use] extern crate juniper;
graphql_value!(1234);
graphql_value!("test");
graphql_value!([ 1234, "test", true ]);
graphql_value!({ "key": "value", "foo": 1234 });