How does @nomath directive work?

In the previous post, we have seen how @noagg directive works
Now we will check how @nomath directive works.

  • When you declare a data type in the schema, Hypi automatically generates Maths data types that are used to implement Mathematical functions.
  • Let’s say you declare an ABC data type. The auto generated data type will be ABCMaths. All the generated Maths data types are parts of in the HypiMathType.
  • If you declare the data type with @nomath directive, the above-mentioned Math data type will not be generated.
  • You will not be able to perform Maths functions on the data type.

Check this guide to learn more about Maths functions.

Declare below Data type in the schema.

type NoMathObj @nomath {
    field: Int
}

The Maths data type NoMathObjMaths will not be generated.If you try to execute a Maths query, below error will pop up in the GraphQL Playground.

Do check below posts to know more about Maths Functions!