Hello World,

GraphQLize is one month old now 🎂, and it is getting better day by day. Almost 50% of the planned features are complete 🙌.

As usual in this blog post, I am going to share what's new in GraphQLize and what is in the pipeline for the next two weeks.

Here we go!

GraphQLize now enables sorting the query results using the orderBy argument. By default, you can use any of the table columns to sort the query results. In future, we can control this behaviour.

Copy query languagesSortedByName { languages ( orderBy : { name : ASC } ) { name } }

If you'd like to sort it in descending order, replace ASC with DESC .

Copy query languagesSortedByNameInDescOrder { languages ( orderBy : { name : DESC } ) { name } }

We can sort by multiple columns as well,

Copy query { actors ( orderBy : { firstName : ASC , lastName : DESC } ) { firstName lastName } }

GraphQLize also supports sorting nested objects.

Copy query { countryByCountryId ( countryId : 2 ) { country cities ( orderBy : { city : DESC } ) { city } } }

Copy query { actorByActorId ( actorId : 148 ) { firstName films ( orderBy : { title : DESC } ) { title } } }

note Currently, sorting nested objects in MySQL is not supported. It'll be fixed in a later release.

Filtering is another critical feature that was released in the last iteration. Like orderBy in sorting, we have the where argument using which we can specify the filter condition.

Here are some of the examples of using eq , in , isNull and between filter conditions.

Copy query { cities ( where : { cityId : { eq : 3 } } ) { city } }

Copy query { payments ( where : { customerId : { in : [ 1 , 2 ] } } ) { paymentId amount } }

Copy query { employees ( where : { employeeReportsToId : { isNull : true } } ) { firstName lastName } }

Copy query { payments ( where : { paymentDate : { between : { from : "2005-08-23T21:00:00" , to : "2005-08-23T21:03:00" } } } ) { rentalId } }

For the detailed set of supported filter conditions, you can check out this documentation.

We can filter the nested objects also.

Copy query { countryByCountryId ( countryId : 2 ) { country cities ( where : { city : { like : "B%" } } ) { cityId city } } }

Copy query { actorByActorId ( actorId : 148 ) { firstName films ( where : { title : { like : "S%" } } ) { title } } }

MySQL Boolean Data Type Support#

The last feature that was developed as part of the previous iteration is the support for MySQL boolean data type.

GraphQLize treats the column types BIT(1) and TINYINT(1) as the Boolean GraphQL scalar type.

Here is an example of using it in a filter condition to filter only active customers.

Copy query { customers ( where : { active : { eq : true } } ) { firstName } }

I am planning to take a short break for two days to sustain my progress and energy level. Then, I am going to work on the following issues for the next two weeks.

Supporting and, or and not operators in the filter conditions.

Ability to filter based on the nested object's fields - GitHub Issue #33

Filter based on the existence of nested objects - GitHub Issue #38

I am keeping this iteration light as I may not be able to spend some good quality time outside my work hours. In case, if I am free, I would take some more features around filtering. Let's see how it goes 🤞.

You can keep track of the progress by

⭐️ If you like GraphQLize, give it a star on GitHub! ⭐️

That's all!

Cheers,

Tamizh