Function graphql_id::get_default_operation_name[][src]

pub fn get_default_operation_name(query: &str) -> Result<String, GraphQLError>

Get the default operation name from the query

Examples

    use graphql_id::*;
    let query = "
        query Foo { foo }
    ";
    get_default_operation_name(&query); // -> Foo

Errors

  • AnonymousOperation - Currently, this library does not support anonymous operations
    • example: query { foo } or { foo }
  • MultipleOperation - When more than one operations are found, there is no default operation.
    • example: query A { a } query B { b }