Skip to content

Commit 74850b3

Browse files
committed
graphql: Rename ObjectCondition to ObjectType
The old name wasn't matching what we use it for any more
1 parent 042ffc4 commit 74850b3

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

graphql/src/execution/ast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use graph::{
77
};
88
use graphql_parser::Pos;
99

10-
use crate::schema::ast::ObjectCondition;
10+
use crate::schema::ast::ObjectType;
1111

1212
/// A selection set is a table that maps object types to the fields that
1313
/// should be selected for objects of that type. The types are always
@@ -300,7 +300,7 @@ impl ObjectTypeSet {
300300
pub(crate) fn resolve_object_types<'a>(
301301
schema: &'a Schema,
302302
name: &str,
303-
) -> Result<HashSet<ObjectCondition<'a>>, QueryExecutionError> {
303+
) -> Result<HashSet<ObjectType<'a>>, QueryExecutionError> {
304304
let mut set = HashSet::new();
305305
match schema
306306
.document

graphql/src/schema/ast.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,47 +53,47 @@ pub(crate) fn parse_field_as_filter(key: &str) -> (String, FilterOp) {
5353

5454
/// An `ObjectType` with `Hash` and `Eq` derived from the name.
5555
#[derive(Clone, Debug)]
56-
pub(crate) struct ObjectCondition<'a>(&'a s::ObjectType);
56+
pub(crate) struct ObjectType<'a>(&'a s::ObjectType);
5757

58-
impl<'a> Ord for ObjectCondition<'a> {
58+
impl<'a> Ord for ObjectType<'a> {
5959
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
6060
self.0.name.cmp(&other.0.name)
6161
}
6262
}
6363

64-
impl<'a> PartialOrd for ObjectCondition<'a> {
64+
impl<'a> PartialOrd for ObjectType<'a> {
6565
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
6666
Some(self.0.name.cmp(&other.0.name))
6767
}
6868
}
6969

70-
impl std::hash::Hash for ObjectCondition<'_> {
70+
impl std::hash::Hash for ObjectType<'_> {
7171
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
7272
self.0.name.hash(state)
7373
}
7474
}
7575

76-
impl PartialEq for ObjectCondition<'_> {
76+
impl PartialEq for ObjectType<'_> {
7777
fn eq(&self, other: &Self) -> bool {
7878
self.0.name.eq(&other.0.name)
7979
}
8080
}
8181

82-
impl Eq for ObjectCondition<'_> {}
82+
impl Eq for ObjectType<'_> {}
8383

84-
impl<'a> From<&'a s::ObjectType> for ObjectCondition<'a> {
84+
impl<'a> From<&'a s::ObjectType> for ObjectType<'a> {
8585
fn from(object: &'a s::ObjectType) -> Self {
86-
ObjectCondition(object)
86+
ObjectType(object)
8787
}
8888
}
8989

90-
impl<'a> From<ObjectCondition<'a>> for ObjectOrInterface<'a> {
91-
fn from(cond: ObjectCondition<'a>) -> Self {
90+
impl<'a> From<ObjectType<'a>> for ObjectOrInterface<'a> {
91+
fn from(cond: ObjectType<'a>) -> Self {
9292
ObjectOrInterface::Object(cond.0)
9393
}
9494
}
9595

96-
impl ObjectCondition<'_> {
96+
impl ObjectType<'_> {
9797
pub fn name(&self) -> &str {
9898
&self.0.name
9999
}

graphql/src/store/prefetch.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ fn execute_selection_set<'a>(
639639
struct CollectedResponseKey<'a> {
640640
iface_cond: Option<&'a s::InterfaceType>,
641641
iface_fields: Vec<&'a a::Field>,
642-
obj_types: IndexMap<sast::ObjectCondition<'a>, Vec<&'a a::Field>>,
642+
obj_types: IndexMap<sast::ObjectType<'a>, Vec<&'a a::Field>>,
643643
collected_column_names: CollectedAttributeNames<'a>,
644644
}
645645

@@ -753,7 +753,7 @@ fn fetch(
753753

754754
/// Represents a finished column collection operation, mapping each object type to the final set of
755755
/// selected SQL columns.
756-
type AttributeNamesByObjectType<'a> = BTreeMap<sast::ObjectCondition<'a>, AttributeNames>;
756+
type AttributeNamesByObjectType<'a> = BTreeMap<sast::ObjectType<'a>, AttributeNames>;
757757

758758
#[derive(Debug, Default, Clone)]
759759
struct CollectedAttributeNames<'a>(HashMap<ObjectOrInterface<'a>, AttributeNames>);

graphql/src/store/query.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use graph::{components::store::EntityType, data::graphql::ObjectOrInterface};
77

88
use crate::execution::ast as a;
99
use crate::schema::ast as sast;
10-
use crate::schema::ast::ObjectCondition;
10+
use crate::schema::ast::ObjectType;
1111

1212
#[derive(Debug)]
1313
enum OrderDirection {
@@ -25,7 +25,7 @@ pub(crate) fn build_query<'a>(
2525
types_for_interface: &'a BTreeMap<EntityType, Vec<s::ObjectType>>,
2626
max_first: u32,
2727
max_skip: u32,
28-
mut column_names: BTreeMap<ObjectCondition<'a>, AttributeNames>,
28+
mut column_names: BTreeMap<ObjectType<'a>, AttributeNames>,
2929
) -> Result<EntityQuery, QueryExecutionError> {
3030
let entity = entity.into();
3131
let entity_types = EntityCollection::All(match &entity {

0 commit comments

Comments
 (0)