Skip to content

Commit 10ecf36

Browse files
committed
InsertOnConflict to OnConflict
1 parent ddf2826 commit 10ecf36

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

src/builder.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,10 @@ where
202202
variable_definitions,
203203
)?;
204204

205-
let insert_type: InsertOnConflictType = match field.get_arg("onConflict") {
205+
let insert_type: OnConflictType = match field.get_arg("onConflict") {
206206
None => return Ok(None),
207207
Some(x) => match x.type_().unmodified_type() {
208-
__Type::InsertOnConflictInput(insert_on_conflict) => insert_on_conflict,
208+
__Type::OnConflictInput(insert_on_conflict) => insert_on_conflict,
209209
_ => return Err("Could not locate Insert Entity type".to_string()),
210210
},
211211
};
@@ -372,12 +372,12 @@ where
372372
// Raise for disallowed arguments
373373
restrict_allowed_arguments(&["objects", "onConflict"], query_field)?;
374374

375-
let objects: Vec<InsertRowBuilder> =
376-
read_argument_objects(field, query_field, variables, variable_definitions)?;
377-
378375
let on_conflict: Option<OnConflictBuilder> =
379376
read_argument_on_conflict(field, query_field, variables, variable_definitions)?;
380377

378+
let objects: Vec<InsertRowBuilder> =
379+
read_argument_objects(field, query_field, variables, variable_definitions)?;
380+
381381
let mut builder_fields: Vec<InsertSelection> = vec![];
382382

383383
let selection_fields = normalize_selection_set(

src/graphql.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ pub enum __Type {
515515
// Mutation
516516
Mutation(MutationType),
517517
InsertInput(InsertInputType),
518-
InsertOnConflictInput(InsertOnConflictType),
518+
OnConflictInput(OnConflictType),
519519
InsertResponse(InsertResponseType),
520520
UpdateInput(UpdateInputType),
521521
UpdateResponse(UpdateResponseType),
@@ -594,7 +594,7 @@ impl ___Type for __Type {
594594
Self::Node(x) => x.kind(),
595595
Self::NodeInterface(x) => x.kind(),
596596
Self::InsertInput(x) => x.kind(),
597-
Self::InsertOnConflictInput(x) => x.kind(),
597+
Self::OnConflictInput(x) => x.kind(),
598598
Self::InsertResponse(x) => x.kind(),
599599
Self::UpdateInput(x) => x.kind(),
600600
Self::UpdateResponse(x) => x.kind(),
@@ -630,7 +630,7 @@ impl ___Type for __Type {
630630
Self::Node(x) => x.name(),
631631
Self::NodeInterface(x) => x.name(),
632632
Self::InsertInput(x) => x.name(),
633-
Self::InsertOnConflictInput(x) => x.name(),
633+
Self::OnConflictInput(x) => x.name(),
634634
Self::InsertResponse(x) => x.name(),
635635
Self::UpdateInput(x) => x.name(),
636636
Self::UpdateResponse(x) => x.name(),
@@ -666,7 +666,7 @@ impl ___Type for __Type {
666666
Self::Node(x) => x.description(),
667667
Self::NodeInterface(x) => x.description(),
668668
Self::InsertInput(x) => x.description(),
669-
Self::InsertOnConflictInput(x) => x.description(),
669+
Self::OnConflictInput(x) => x.description(),
670670
Self::InsertResponse(x) => x.description(),
671671
Self::UpdateInput(x) => x.description(),
672672
Self::UpdateResponse(x) => x.description(),
@@ -703,7 +703,7 @@ impl ___Type for __Type {
703703
Self::Node(x) => x.fields(_include_deprecated),
704704
Self::NodeInterface(x) => x.fields(_include_deprecated),
705705
Self::InsertInput(x) => x.fields(_include_deprecated),
706-
Self::InsertOnConflictInput(x) => x.fields(_include_deprecated),
706+
Self::OnConflictInput(x) => x.fields(_include_deprecated),
707707
Self::InsertResponse(x) => x.fields(_include_deprecated),
708708
Self::UpdateInput(x) => x.fields(_include_deprecated),
709709
Self::UpdateResponse(x) => x.fields(_include_deprecated),
@@ -740,7 +740,7 @@ impl ___Type for __Type {
740740
Self::Node(x) => x.interfaces(),
741741
Self::NodeInterface(x) => x.interfaces(),
742742
Self::InsertInput(x) => x.interfaces(),
743-
Self::InsertOnConflictInput(x) => x.interfaces(),
743+
Self::OnConflictInput(x) => x.interfaces(),
744744
Self::InsertResponse(x) => x.interfaces(),
745745
Self::UpdateInput(x) => x.interfaces(),
746746
Self::UpdateResponse(x) => x.interfaces(),
@@ -786,7 +786,7 @@ impl ___Type for __Type {
786786
Self::Node(x) => x.enum_values(_include_deprecated),
787787
Self::NodeInterface(x) => x.enum_values(_include_deprecated),
788788
Self::InsertInput(x) => x.enum_values(_include_deprecated),
789-
Self::InsertOnConflictInput(x) => x.enum_values(_include_deprecated),
789+
Self::OnConflictInput(x) => x.enum_values(_include_deprecated),
790790
Self::InsertResponse(x) => x.enum_values(_include_deprecated),
791791
Self::UpdateInput(x) => x.enum_values(_include_deprecated),
792792
Self::UpdateResponse(x) => x.enum_values(_include_deprecated),
@@ -823,7 +823,7 @@ impl ___Type for __Type {
823823
Self::Node(x) => x.input_fields(),
824824
Self::NodeInterface(x) => x.input_fields(),
825825
Self::InsertInput(x) => x.input_fields(),
826-
Self::InsertOnConflictInput(x) => x.input_fields(),
826+
Self::OnConflictInput(x) => x.input_fields(),
827827
Self::InsertResponse(x) => x.input_fields(),
828828
Self::UpdateInput(x) => x.input_fields(),
829829
Self::UpdateResponse(x) => x.input_fields(),
@@ -971,7 +971,7 @@ pub struct InsertResponseType {
971971
}
972972

973973
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
974-
pub struct InsertOnConflictType {
974+
pub struct OnConflictType {
975975
pub table: Arc<Table>,
976976
pub schema: Arc<__Schema>,
977977
}
@@ -1456,7 +1456,7 @@ impl ___Type for MutationType {
14561456
if table.has_upsert_support() {
14571457
args.push(__InputValue {
14581458
name_: "onConflict".to_string(),
1459-
type_: __Type::InsertOnConflictInput(InsertOnConflictType {
1459+
type_: __Type::OnConflictInput(OnConflictType {
14601460
table: Arc::clone(table),
14611461
schema: Arc::clone(&self.schema),
14621462
}),
@@ -3162,7 +3162,7 @@ impl ___Type for InsertInputType {
31623162
}
31633163
}
31643164

3165-
impl ___Type for InsertOnConflictType {
3165+
impl ___Type for OnConflictType {
31663166
fn kind(&self) -> __TypeKind {
31673167
__TypeKind::INPUT_OBJECT
31683168
}
@@ -4294,7 +4294,7 @@ impl __Schema {
42944294

42954295
// Used exclusively by onConflict
42964296
if table.has_upsert_support() {
4297-
types_.push(__Type::InsertOnConflictInput(InsertOnConflictType {
4297+
types_.push(__Type::OnConflictInput(OnConflictType {
42984298
table: Arc::clone(table),
42994299
schema: Arc::clone(&schema_rc),
43004300
}));

src/parser_util.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -472,11 +472,12 @@ pub fn validate_arg_from_type(type_: &__Type, value: &gson::Value) -> Result<gso
472472
_ => out_elem,
473473
}
474474
}
475-
__Type::InsertInput(_) => validate_arg_from_input_object(type_, value)?,
476-
__Type::UpdateInput(_) => validate_arg_from_input_object(type_, value)?,
477-
__Type::OrderByEntity(_) => validate_arg_from_input_object(type_, value)?,
478-
__Type::FilterType(_) => validate_arg_from_input_object(type_, value)?,
479-
__Type::FilterEntity(_) => validate_arg_from_input_object(type_, value)?,
475+
__Type::InsertInput(_)
476+
| __Type::UpdateInput(_)
477+
| __Type::OrderByEntity(_)
478+
| __Type::FilterType(_)
479+
| __Type::FilterEntity(_)
480+
| __Type::OnConflictInput(_) => validate_arg_from_input_object(type_, value)?,
480481
_ => {
481482
return Err(format!(
482483
"Invalid Type used as input argument {}",

0 commit comments

Comments
 (0)