[][src]Macro juniper::graphql_value

macro_rules! graphql_value {
    ([ $($arg:tt),* $(,)* ]) => { ... };
    ({ $($key:tt : $val:tt ),* $(,)* }) => { ... };
    (None) => { ... };
    ($e:expr) => { ... };
}

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.

extern crate juniper;

graphql_value!(None);
graphql_value!(1234);
graphql_value!("test");
graphql_value!([ 1234, "test", true ]);
graphql_value!({ "key": "value", "foo": 1234 });