Delete operations

Delete table records using _delete(filter), with results shown in affectedRows. Works similarly to update filters. Example provided.

Delete operations are available through a field having the name of the form <tablename>_delete of a type having the name of the form <parenttype>_<tablename>_Result. For instance, for the Associate table, the field is called associate_delete and its type is Mutation_UseCompany_Associate_Result. The result type is the same for inserts, updates, and deletes.

The form of this operation is the following:

associate_delete(filter: FilterExpression_Associate): Mutation_UseCompany_Associate_Result

The <tablename>_delete field has a single argument called filter which defines the selection filter for the records to be delete. This is the same filter used for update operations.

A delete operation has the following form (in this example we delete all the associates that have the associateNo field greater than 546):

Query

mutation delete_associate($cid : Int!)
{
  useCompany(no: $cid)
  {
    associate_delete(filter : {
      associateNo : {_gt : 546}})
    {
      affectedRows
    }
  }
}
Result

{
  "data": {
    "useCompany": {
      "associate_delete": {
        "affectedRows": 2
      }
    }
  }
}

The value of the items field of the return type will always be null for a delete operation. The API does not return the value of the records that were deleted.

Last modified September 24, 2024