pub struct QueryBuilder<'schema, 'fragreg>(/* private fields */);Implementations§
Source§impl<'schema: 'fragreg, 'fragreg> QueryBuilder<'schema, 'fragreg>
impl<'schema: 'fragreg, 'fragreg> QueryBuilder<'schema, 'fragreg>
Sourcepub fn add_directive(
self,
annot: DirectiveAnnotation,
) -> Result<Self, QueryBuildError>
pub fn add_directive( self, annot: DirectiveAnnotation, ) -> Result<Self, QueryBuildError>
Add a DirectiveAnnotation after any previously added
DirectiveAnnotations.
Sourcepub fn add_selection(
self,
selection: Selection<'schema>,
) -> Result<Self, QueryBuildError>
pub fn add_selection( self, selection: Selection<'schema>, ) -> Result<Self, QueryBuildError>
Add a Selection after any previously added Selections.
Sourcepub fn add_variable(self, variable: Variable) -> Result<Self, QueryBuildError>
pub fn add_variable(self, variable: Variable) -> Result<Self, QueryBuildError>
Add a Variable after any previously added Variables.
Sourcepub fn build(self) -> Result<Query<'schema, 'fragreg>, QueryBuildError>
pub fn build(self) -> Result<Query<'schema, 'fragreg>, QueryBuildError>
Consume this QueryBuilder to produce a Query.
Sourcepub fn build_from_ast(
schema: &'schema Schema,
fragment_registry: &'fragreg FragmentRegistry<'schema>,
ast: &Query,
file_path: Option<&Path>,
) -> Result<Query<'schema, 'fragreg>, QueryBuildError>
pub fn build_from_ast( schema: &'schema Schema, fragment_registry: &'fragreg FragmentRegistry<'schema>, ast: &Query, file_path: Option<&Path>, ) -> Result<Query<'schema, 'fragreg>, QueryBuildError>
Produce a Query from a ast::operation::Query.
Sourcepub fn build_from_file(
schema: &'schema Schema,
fragment_registry: &'fragreg FragmentRegistry<'schema>,
file_path: impl AsRef<Path>,
) -> Result<Query<'schema, 'fragreg>, QueryBuildError>
pub fn build_from_file( schema: &'schema Schema, fragment_registry: &'fragreg FragmentRegistry<'schema>, file_path: impl AsRef<Path>, ) -> Result<Query<'schema, 'fragreg>, QueryBuildError>
Produce a Query from a file on disk that whose contents contain an
executable document
with only a single query defined in it.
If multiple operations are defined in the document, an error will be
returned. For cases where multiple operations may be defined in a single
document, use
ExecutableDocumentBuilder.
If the document contents include any fragment definitions, an error will be returned. For cases where operations and fragments may be defined together in a single document, use ’ExecutableDocumentBuilder`.
Sourcepub fn build_from_str(
schema: &'schema Schema,
fragment_registry: &'fragreg FragmentRegistry<'schema>,
file_path: Option<&Path>,
content: impl AsRef<str>,
) -> Result<Query<'schema, 'fragreg>, QueryBuildError>
pub fn build_from_str( schema: &'schema Schema, fragment_registry: &'fragreg FragmentRegistry<'schema>, file_path: Option<&Path>, content: impl AsRef<str>, ) -> Result<Query<'schema, 'fragreg>, QueryBuildError>
Produce a Query from a string whose contents contain a
document with only
a single query defined in it.
If multiple operations are defined in the document, an error will be
returned. For cases where multiple operations may be defined in a single
document, use
ExecutableDocumentBuilder.
If the document contents include any fragment definitions, an error will be returned. For cases where operations and fragments may be defined together in a single document, use ’ExecutableDocumentBuilder`.
Sourcepub fn from_ast(
schema: &'schema Schema,
fragment_registry: &'fragreg FragmentRegistry<'schema>,
ast: &Query,
file_path: Option<&Path>,
) -> Result<Self, QueryBuildError>
pub fn from_ast( schema: &'schema Schema, fragment_registry: &'fragreg FragmentRegistry<'schema>, ast: &Query, file_path: Option<&Path>, ) -> Result<Self, QueryBuildError>
Produce a QueryBuilder from a Query.
Sourcepub fn from_file(
schema: &'schema Schema,
fragment_registry: &'fragreg FragmentRegistry<'schema>,
file_path: impl AsRef<Path>,
) -> Result<Self, QueryBuildError>
pub fn from_file( schema: &'schema Schema, fragment_registry: &'fragreg FragmentRegistry<'schema>, file_path: impl AsRef<Path>, ) -> Result<Self, QueryBuildError>
Produce a QueryBuilder from a file on disk that whose contents
contain an
executable document
with only a single query defined in it.
If multiple operations are defined in the document, an error will be
returned. For cases where multiple operations may be defined in a single
document, use
ExecutableDocumentBuilder.
If the document contents include any fragment definitions, an error will be returned. For cases where operations and fragments may be defined together in a single document, use ’ExecutableDocumentBuilder`.
Sourcepub fn from_str(
schema: &'schema Schema,
fragment_registry: &'fragreg FragmentRegistry<'schema>,
content: impl AsRef<str>,
file_path: Option<&Path>,
) -> Result<Self, QueryBuildError>
pub fn from_str( schema: &'schema Schema, fragment_registry: &'fragreg FragmentRegistry<'schema>, content: impl AsRef<str>, file_path: Option<&Path>, ) -> Result<Self, QueryBuildError>
Produce a QueryBuilder from a string whose contents contain a
document with only
a single query defined in it.
If multiple operations are defined in the document, an error will be
returned. For cases where multiple operations may be defined in a single
document, use
ExecutableDocumentBuilder.
If the document contents include any fragment definitions, an error will be returned. For cases where operations and fragments may be defined together in a single document, use ’ExecutableDocumentBuilder`.
Sourcepub fn new(
schema: &'schema Schema,
fragment_registry: &'fragreg FragmentRegistry<'schema>,
) -> Self
pub fn new( schema: &'schema Schema, fragment_registry: &'fragreg FragmentRegistry<'schema>, ) -> Self
See [OperationBuilderTrait::new]
Sourcepub fn set_directives(
self,
directives: &[DirectiveAnnotation],
) -> Result<Self, QueryBuildError>
pub fn set_directives( self, directives: &[DirectiveAnnotation], ) -> Result<Self, QueryBuildError>
Set the list of DirectiveAnnotations.
NOTE: If any previous directives were added (either using this function
or QueryBuilder::add_directive()), they will be fully replaced by
the DirectiveAnnotations passed here.
Sourcepub fn set_name(self, name: Option<String>) -> Result<Self, QueryBuildError>
pub fn set_name(self, name: Option<String>) -> Result<Self, QueryBuildError>
Set the name of the Query.
Sourcepub fn set_variables(
self,
variables: Vec<Variable>,
) -> Result<Self, QueryBuildError>
pub fn set_variables( self, variables: Vec<Variable>, ) -> Result<Self, QueryBuildError>
Set the list of Variables.
NOTE: If any previous variables were added (either using this function
or QueryBuilder::add_variable()), they will be fully replaced by the
collection of variables passed here.
Trait Implementations§
Source§impl<'schema, 'fragreg> Clone for QueryBuilder<'schema, 'fragreg>
impl<'schema, 'fragreg> Clone for QueryBuilder<'schema, 'fragreg>
Source§fn clone(&self) -> QueryBuilder<'schema, 'fragreg>
fn clone(&self) -> QueryBuilder<'schema, 'fragreg>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'schema, 'fragreg> Debug for QueryBuilder<'schema, 'fragreg>
impl<'schema, 'fragreg> Debug for QueryBuilder<'schema, 'fragreg>
Source§impl<'schema, 'fragreg> PartialEq for QueryBuilder<'schema, 'fragreg>
impl<'schema, 'fragreg> PartialEq for QueryBuilder<'schema, 'fragreg>
Source§fn eq(&self, other: &QueryBuilder<'schema, 'fragreg>) -> bool
fn eq(&self, other: &QueryBuilder<'schema, 'fragreg>) -> bool
self and other values to be equal, and is used by ==.