Does dgraph DQL have a custom handler function?

No, we have custom DQL in GraphQL. But no functions like that.

You can try Lambdas for your case.